I have an XML file (generated by a third party tool) which is of format
<?xml version="1.0" encoding="UTF-8"?><ROOT test_count="22" test_fail_count="1" test_pass_count="21".......</ROOT>
All the content is in one line of the file with name Report.xml.
I have been trying to write a batch script
@echo off
setlocal EnableDelayedExpansion
set "Report="
for /f "delims=" %%x in (Report.xml) do set "Report=!Report! %%x"
REm set /p Report=< %Results_File%
echo report is !Report!
call:parseVal !Report!
exit/b
:parseVal
setlocal enableDelayedExpansion
set val="%~1"
echo %val%
echo !val!|findstr /rc:"test_count=.[0-9]*." >nul || (
echo !val!
EndLocal
exit /b
)
rem ..
Basically I am trying to grab values for test_count(22), test_fail_count(1) and test_pass_count(21) from the XML file.
Any ideas on how to achieve this?