Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Writing to XML

I have been trying to write to an XML file as a way of cataloging placed configurations of the object. I have no problems reading and writing to XML except I cannot for the life of me create a new element on its own line.
regardless of the RecordID I use the new element is always placed on the same line as the position descriptor rather than its own line.

this is the basic structure of the XML ("---" are there just to show the structure because this forum wasn't recognizing the tabs or spaces)
<?xml version="1.0" encoding="UTF-8"?>
<dataroot>
---<Model>
------<name>Config 01</name>
------<x>0.48</x>
------<y>0.24</y>
------<z>0.8</z>
---</Model>
---<Model>
------<name>Config 02</name>
------<x>0.24</x>
------<y>0.48</y>
------<z>0.4</z>
---</Model>
</dataroot>

I want to copy the last "Model" and place in below and then modify its properties (x,y,z). I have tried different position descriptors and all of the "AsLastChild", "AsPreviousSibling" and so on statements but i always end up with something like this.
<dataroot>
---<Model>
------<name>Config 01</name>
------<x>0.48</x>
------<y>0.24</y>
------<z>0.8</z>
---</Model>
---<Model>
------<name>Config 02</name>
------<x>0.24</x>
------<y>0.48</y>
------<z>0.4</z>
---<Model>
------<name>Config 02</name>
------<x>0.24</x>
------<y>0.48</y>
------<z>0.4</z>
---</Model></Model>
</dataroot>

I have tried more basic functions but no matter what it always end up on the same line as the position descriptor
Creator of Cadswift's parametric GDL libraries
Creator of Infinite Openings and Component Catalogues
Push the envelope & watch it bend
website: https://cadswift.com.au/
YouTube: https://www.youtube.com/user/CADSwift/playlists
0 REPLIES 0

Start a new conversation!

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!