Just add <model> string after <?xml version="1.0" encoding="UTF-8"?> and </model> to the end of file. I guess it's not necessary to parse the whole document to add root element.
answered 2014-01-08 13:02 fabian
Your problem is, that your xml string is not well formed (see Wikipedia article). The root element has to be unique. You have 4 "root" elements: id, parentid, version and nodes.
Thererfore it cannot be parsed using a XML parser that expects well-formed input. I' m afraid you have to modify the string as text either programmatically or by hand. Insert a start tag after <?xml version="1.0" encoding="UTF-8"?> and add the corresponding end tag at the end of the string.