TXMLDocumentAddChild (Delphi)
Description
This example sets the document element by adding a child element to the document.
Code
procedure Test_AddChild;
var
LDocument: IXMLDocument;
LNode: IXMLNode;
begin
LDocument := TXMLDocument.Create(nil);
LDocument.Active := True;
{ Add new child. This will become the document element.
If the document element already exists, then an exception is raised. }
LNode := LDocument.AddChild('Airbus');
{ Display document content. }
Writeln(LDocument.XML.Text);
end;
Uses
- Xml.XMLDoc.TXMLDocument.Active ( fr | de | ja )
- Xml.XMLDoc.TXMLDocument.AddChild ( fr | de | ja )
- Xml.XMLDoc.TXMLDocument.XML ( fr | de | ja )