Game Development Community

XML Question

by Robert Fritzen · in Torque 3D Professional · 12/16/2011 (6:51 pm) · 2 replies

I've done some digging on the forums but I cannot seem to find anything on making nested elements using a SimXMLDocument Object.

I'm looking to do this:

<MyObject>
   <MySubObject name="SomeName">
      <Item someInfo="hello">Blah</Item>
      <Item someInfo="hi">Blah2</Item>
   </MySubObject>
</MyObject>

Any pointers here? Or am I going to need to resort to using a fileObject for this?

About the author

At the young age of 22, and a UIUC Graduate, I just love video game development, and draw a massive 8+ yr. experience with this engine from Tribes 2. I plan on using Torque for many (if not all) of my future projects.


#1
12/16/2011 (10:33 pm)
The script manual shows an example and explanation of how to do this. Looks like you need to use the addNewElement() function to make a nested element.
#2
12/18/2011 (8:49 am)
I got it working, sort of. Had to do a little more digging, but it works to what I need it for. I can nest elements, and I think I can set attributes using the attribute() function.

Thanks for the pointer though, I'll be sure to give it a look at to see if any other useful info is there.