Open bolte-io opened 2 years ago
To clarify, the XML file/script I am attempting to parse is an XML document, with sections of INI files inside the tags.
<script>
<scriptversion>
1.3
</scriptversion>
<data file="data\ships\shiparch.ini" method="append">
<source>
[Ship]
ids_name = 0 ;GENERATESTRRES("Heavy Lifter")
ids_info = 0 ;GENERATEXMLRES(";GENERATEXMLRES("<xml><RDL><PUSH/><TEXT> </TEXT><PARA/><TRA data="1" mask="1" def="-2"/><JUST loc="center"/><TEXT>Stats</TEXT><PARA/><TRA data="0" mask="1" def="-1"/><JUST loc="left"/><TEXT> </TEXT><PARA/><TEXT>Gun/Turret Mounts: 0/5</TEXT><PARA/><TEXT>Armor: 15000</TEXT><PARA/><TEXT>Cargo Space: 400</TEXT><PARA/><TEXT>Max Batteries/Repair Kits: 100/100</TEXT><PARA/><TEXT>Optimal Weapon Class: NA</TEXT><PARA/><TEXT>Max. Weapon Class: NA</TEXT><PARA/><TEXT>Add'l Equipment: NONE</TEXT><PARA/><PARA/><POP/></RDL></xml>")")
ids_info1 = 0 ;GENERATEXMLRES("Info2")
ids_info2 = 66608
ids_info3 = 0 ;GENERATEXMLRES("Info3")
ship_class = 2
nickname = ge_lifter2
</source>
</data>
<data file="data\ships\ships.ini" method="replace">
<source>
[Ship]
ids_name = 0 ;GENERATESTRRES("Heavy Lifter")
ids_info = 0 ;GENERATEXMLRES("<xml><RDL><PUSH/><TEXT> </TEXT><PARA/><TRA data="1" mask="1" def="-2"/><JUST loc="center"/><TEXT>Stats</TEXT><PARA/><TRA data="0" mask="1" def="-1"/><JUST loc="left"/><TEXT> </TEXT><PARA/><TEXT>Gun/Turret Mounts: 0/5</TEXT><PARA/><TEXT>Armor: 15000</TEXT><PARA/><TEXT>Cargo Space: 400</TEXT><PARA/><TEXT>Max Batteries/Repair Kits: 100/100</TEXT><PARA/><TEXT>Optimal Weapon Class: NA</TEXT><PARA/><TEXT>Max. Weapon Class: NA</TEXT><PARA/><TEXT>Add'l Equipment: NONE</TEXT><PARA/><PARA/><POP/></RDL></xml>")
ids_info1 = 0 ;GENERATESTRRES("Info2")
ids_info2 = 0 ;GENERATESTRRES("Info3")
ids_info3 = 0 ;GENERATEXMLRES("Info4")
ship_class = 2
nickname = ge_lifter2
</source>
</data>
</script>
I would like to be able to parse the document and strip out the INI data intact without it being parsed by the XML parser.
I also tried converting the extracted XML back from JSON to XML. It is not identical:
Original XML:
<xml><RDL><PUSH/><TEXT></TEXT><PARA/><TRA data="1" mask="1" def="-2"/><JUST loc="center"/><TEXT>Stats</TEXT><PARA/><TRA data="0" mask="1" def="-1"/><JUST loc="left"/><TEXT> </TEXT><PARA/><TEXT>Gun/Turret Mounts: 0/5</TEXT><PARA/><TEXT>Armor: 15000</TEXT><PARA/><TEXT>Cargo Space: 400</TEXT><PARA/><TEXT>Max Batteries/Repair Kits: 100/100</TEXT><PARA/><TEXT>Optimal Weapon Class: NA</TEXT><PARA/><TEXT>Max. Weapon Class: NA</TEXT><PARA/><TEXT>Add'l Equipment: NONE</TEXT><PARA/><PARA/><POP/></RDL></xml>
and now the converted output:
<RDL><PUSH></PUSH><TEXT></TEXT><TEXT>Stats</TEXT><TEXT></TEXT><TEXT>Gun/Turret Mounts: 0/5</TEXT><TEXT>Armor: 15000</TEXeT><TEXT>Cargo Space: 400</TEXT><TEXT>Max Batteries/Repair Kits: 100/100</TEXT><TEXT>Optimal Weapon Class: NA</TEXT><TEXT >Max. Weapon Class: NA</TEXT><TEXT>Add'l Equipment: NONE</TEXT><PARA></PARA><PARA></PARA><PARA></PARA><PARA></PARA><PARA<></PARA><PARA></PARA><PARA></PARA><PARA></PARA><PARA></PARA><PARA></PARA><PARA></PARA><TRA data="1" mask="1" def="-2"></ TRA><TRA data="0" mask="1" def="-1"></TRA><JUST loc="center"></JUST><JUST loc="left"></JUST><POP></POP></RDL>
The missing xml tags I can sort if needed, but the structure is not the same.
Hey, I am using this sample data...