I have a xml file containing the xml header and xml footer and I want to remove the header and footer and store the content in a variable. The xml file's content changes inside a loop.
For example:
for (some range) do (
set "xmlHeader=<?xml version="1.0" encoding="UTF-8"?><Config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">"
set "xmlFooter=</Config>"
<then get and set variable from xml file>
)
The xml file contains:
<?xml version="1.0" encoding="UTF-8"?><Config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
<tag1>info1 changes in the loop</tag1>
<tag2>info2 changes in the loop</tag2>
</Config>
And I want a variable in batch be storing
<tag1>info1</tag1>
<tag2>info2</tag2>
I've tried:
for (outer loop condition ) do (
for /f "Tokens=* Delims=" %%c in (xmlFile.xml) do set config=%%c
"!config:%xmlHeader%=!"
echo "!config!"
)
But the replace didn't do anything. Please help! Thank you.