xml ヘッダーと xml フッターを含む xml ファイルがあり、ヘッダーとフッターを削除して、コンテンツを変数に保存したいと考えています。ループ内で xml ファイルの内容が変更されます。
例えば:
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>
)
xml ファイルには以下が含まれます。
<?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>
そして、バッチの変数を保存したい
<tag1>info1</tag1>
<tag2>info2</tag2>
私はもう試した:
for (outer loop condition ) do (
for /f "Tokens=* Delims=" %%c in (xmlFile.xml) do set config=%%c
"!config:%xmlHeader%=!"
echo "!config!"
)
しかし、交換は何もしませんでした。助けてください!ありがとうございました。