I\'m new to delphi and now I have to read create an xml. my code is the following:
function foo.createXMLDocument(): TXMLDocument;
var
res: TXMLDocument;
The Delphi Help of TXMLDocument.AddChild method says (at the bottom):
Note: Do not call AddChild to add a child to the document element of this document. When adding data to the XML document, use the AddChild method of the document element or of the node in the hierarchy that should be the parent of the new node.
And this is what you are doing right? :-)
Here is an introduction article about Delphi XML Document Programming and shows how you can work with the TXMLDocument.DocumentElement property instead of your definition of the rootnode variable in your code.