I’m trying to save a file in a xmldocument, my code exists of many different object, and I want to save them in 1 document. I got an error on this piece of code:
EventsXML = root.AppendChild(Xml.CreateElement("events"))
For Each E As ControlEvent In Events.Values
EventXML = EventsXML.AppendChild(E.SaveToXML)
Catch ex As XmlException
And the code of ControlEvent.SaveToXML is:
[code] Dim Xml As New XmlDocument
Dim root As xmlNode
root = xml.AppendChild(Xml.CreateElement(“controlevent”))
I ran into a Hierarchy request error.
I figured it out that was maybe because I tried to nest a XmlDocument in a XmlDocument, so I tried to change the last line of the last piece of code into
But than I got the “XmlException: Node used in a document that did not create it” error. What is the proper way to nest an XmlNode from a function in another XmlNode?
Thanks in advance.