I am trying to read the content of XML file to get a particular value from a tag and export in another .txt or .xls file. The XML file looks like:
<definition name=”.test1″ extends=”.b”>
<put name=”id” value=”TR012″ />
</definition>
<definition name=”.test2″ extends=”.b”>
<put name=”id” value=”TR013″ />
</definition>
The XML file has multiple such entries and i want to read:
1) the value in name property of definition tag
2) the value in value property of <put> tag
Currently when i tried i got only the last value and not all of them. Is it possible to retrieve internal specific values and export to another file through BAT file?
Need Help on this piece
for /f “tokens=1,2,3* delims==” %%a in (C:\\test.xml) do (
if /i “%%a” equ “<definition name” call :zz %%b
if /i “%%a” equ “<put name” call :zz “%%~c”
)
goto :eof
:zz
echo %~1
::=== not fully test, might need tweaked.