I have an XML file with the following structure:
<?xml version="1.0" encoding="UTF-8"?>
<header>
<name>generic_1</name>
</header>
<body>
<resources>
<resource guid="ae8c34ad-a4e6-47fe-9b7d-cd60223754fe">
</resource>
<resource guid="fe236467-3df5-4019-9d55-d4881dfabae7">
</resource>
</resources>
</body>
I need to edit the information of each resource so I tried to split the file by the string </resource>
but TCL doesn't split it properly.
This is what I tried: split $file "</resource>"
. I also tried escaping the <, / and > characters but still no success.
Can you please help me with an elegant solution? I can do it by taking each line and determining where the resource
ends, but a split
would be nicer, if it can be done.
LE: I can't use tdom, I am editing the file as a text file, not as a XML file.
Thank you