|
NativeXml Help
|
<?xml version="1.0" encoding="windows-1252"?>
<Root>
<Customer ID="123456">
<Name>John Doe</Name>
</Customer>
</Root>
procedure CreateXML; var ADoc: TNativeXml; begin // Create new document with a rootnode called "Root" ADoc := TNativeXml.CreateName('Root'); try // Add a subnode with name "Customer" with ADoc.Root.NodeNew('Customer') do begin // Add an attribute to this subnode WriteAttributeInteger('ID', 123456); // Add subsubnode WriteString('Name', 'John Doe'); end; // Save the XML in readable format (so with indents) ADoc.XmlFormat := xfReadable; // Save results to a file ADoc.SaveToFile('c:\test.xml'); finally ADoc.Free; end; end;