2

I use DOM to create an xml file. Everything is generated correctly, but I have no idea how to set namespaces. I saw lot solutions (for example How do I add a namespace prefix to each node using TXMLDocument), but any not work in Lazarus. I need generate XML like:

<?xml version="1.0" encoding="UTF-8"?><tns:string xmlns:etd="uri "    xmlns:tns="uri" xmlns:xsi="uri">
<tns:RootNode >
<tns:SomeNode>
     <tns:AnotherNode>Value</NS:AnotherNode>
 </tns:SomeNode>
</tns:RootNode>

I try this:

TRY
Doc := TXMLDocument.Create;
doc.CreateElementNS('tns:','uri');
RootNode := Doc.CreateElement('Element');
Doc.Appendchild(RootNode);
....
....
writeXMLFile(Doc,xmlfile);

finally
Doc.Free;
end; 

RootNode:= Doc.DocumentElement;

without any result Doc don't have a uri and tns

Please help me!

0 Answers0