M
Markus Freitag
Guest
Hello,
I have 1000 XML files to adjust.
I have to subtract the index by 1 at each position.
Each file has two or more groups.
newValue = value - 1;
<POSITION>
<INDEX value="1" /> to <INDEX value="0" />
<NUMBER value="1" />
<XPOS value="45.598" />
<YPOS value="61.352" />
<ZPOS value="0" />
</POSITION>
<POSITION>
<INDEX value="2" /> to <INDEX value="1" />
<NUMBER value="2" />
<XPOS value="65.598" />
<YPOS value="81.352" />
<ZPOS value="0" />
</POSITION>
-WHITEGROUP
-BLACKGROUP
..- XXXX_GROUP
Read in, save the changes.
What is the best way to do this with XDocument (XElement).
Before saving the file, make a temporary backup of the previous file.
Does anyone have a good tip.
Thanks in advance.
With best regards Markus
<!-- Original -->
<ROOT>
<PRODUCTLAYOUT>
<IDENTNR value="0" />
<WHITEGROUP>
<POSITIONS>
<POSITION>
<INDEX value="1" />
<NUMBER value="1" />
<XPOS value="45.598" />
<YPOS value="61.352" />
<ZPOS value="0" />
</POSITION>
<POSITION>
<INDEX value="2" />
<NUMBER value="2" />
<XPOS value="65.598" />
<YPOS value="81.352" />
<ZPOS value="0" />
</POSITION>
...
<POSITION>
<INDEX value="99" />
<NUMBER value="99" />
<XPOS value="465.598" />
<YPOS value="481.352" />
<ZPOS value="0" />
</POSITION>
</POSITIONS>
<WHITEGROUP>
<BLACKGROUP>
<POSITIONS>
<POSITION>
<INDEX value="1" />
<NUMBER value="1" />
<XPOS value="45.598" />
<YPOS value="61.352" />
<ZPOS value="0" />
</POSITION>
<POSITION>
<INDEX value="2" />
<NUMBER value="2" />
<XPOS value="65.598" />
<YPOS value="81.352" />
<ZPOS value="0" />
</POSITION>
...
<POSITION>
<INDEX value="99" />
<NUMBER value="99" />
<XPOS value="465.598" />
<YPOS value="481.352" />
<ZPOS value="0" />
</POSITION>
</POSITIONS>
<BLACKGROUP>
Continue reading...
I have 1000 XML files to adjust.
I have to subtract the index by 1 at each position.
Each file has two or more groups.
newValue = value - 1;
<POSITION>
<INDEX value="1" /> to <INDEX value="0" />
<NUMBER value="1" />
<XPOS value="45.598" />
<YPOS value="61.352" />
<ZPOS value="0" />
</POSITION>
<POSITION>
<INDEX value="2" /> to <INDEX value="1" />
<NUMBER value="2" />
<XPOS value="65.598" />
<YPOS value="81.352" />
<ZPOS value="0" />
</POSITION>
-WHITEGROUP
-BLACKGROUP
..- XXXX_GROUP
Read in, save the changes.
What is the best way to do this with XDocument (XElement).
Before saving the file, make a temporary backup of the previous file.
Does anyone have a good tip.
Thanks in advance.
With best regards Markus
<!-- Original -->
<ROOT>
<PRODUCTLAYOUT>
<IDENTNR value="0" />
<WHITEGROUP>
<POSITIONS>
<POSITION>
<INDEX value="1" />
<NUMBER value="1" />
<XPOS value="45.598" />
<YPOS value="61.352" />
<ZPOS value="0" />
</POSITION>
<POSITION>
<INDEX value="2" />
<NUMBER value="2" />
<XPOS value="65.598" />
<YPOS value="81.352" />
<ZPOS value="0" />
</POSITION>
...
<POSITION>
<INDEX value="99" />
<NUMBER value="99" />
<XPOS value="465.598" />
<YPOS value="481.352" />
<ZPOS value="0" />
</POSITION>
</POSITIONS>
<WHITEGROUP>
<BLACKGROUP>
<POSITIONS>
<POSITION>
<INDEX value="1" />
<NUMBER value="1" />
<XPOS value="45.598" />
<YPOS value="61.352" />
<ZPOS value="0" />
</POSITION>
<POSITION>
<INDEX value="2" />
<NUMBER value="2" />
<XPOS value="65.598" />
<YPOS value="81.352" />
<ZPOS value="0" />
</POSITION>
...
<POSITION>
<INDEX value="99" />
<NUMBER value="99" />
<XPOS value="465.598" />
<YPOS value="481.352" />
<ZPOS value="0" />
</POSITION>
</POSITIONS>
<BLACKGROUP>
Continue reading...