Hi everyone!
I have a 2 questions about XML use in JUCE,
that I haven’t found any clear information for in the manual…
I’m using XmlElements as “nodes” in a large tree structure to store all my app’s data.
The top node is called root, and it has many leaf and branch nodes.
The children of one node are simply attached as child node(s) using the XmlElements.
- Deleting a tree of XmlElements
If I, for example, create an XmlElement called “root”,
XmlElement* rootNode = new XmlElement(“root”); (BTW: I use pointers and allocate with “new”)
and then attach a tree of child XmlElement nodes to it,
and I delete the root node, will all the connected child nodes of the whole tree be deleted too?,
or do I have to delete them all manually ?
If it’s possible to have them all deleted automatically with the node I’m deleting, how do I do that?
Also, this would be for any node in the tree,
so if i delete a node somewhere in the tree, will all of that node’s children be deleted too,
or again, do I have to delete them all manually ?
- Copying a tree or parts of it.
Let’s say that I want to copy my root XmlElement with lots of child nodes attached to a new XmlElement,
with the whole tree also copied and attached.
Eg, I’d like an identical tree that is fully separated and has no links in any way
to the original/first tree.
Can I just copy the original XmlElement? and if so, how do I do it ?
Or, do I need to manually copy each element of the tree and attach it, set attributes etc… ?
Or, as in the previous point, how can I copy a part of a tree, eg an element somewhere
down in the tree, with all it’s children etc… copied and attached identically.
This way I can easily copy/paste data around and easily implement a multiple undo/redo system.
Would be cool if someone can clarify the above 2 questions for me…
Much appreciated!,
Cheers,
Terrence
