I have a whole lot of code which generates a XML using TXMLDocument, that looks like this:
function Obj.SaveToXmlNode(XmlNode: IXmlNode; SubnodeName: string): IX
You might want to have a look at NativeXML or OmniXML