TXMLDocumentCreateElement (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example uses the CreateElement function.

Code

procedure Test_CreateElement;
var
  LDocument: IXMLDocument;
  LNode: IXMLNode;
begin
  LDocument := TXMLDocument.Create(nil);
  LDocument.Active := True;

  LNode := LDocument.CreateElement('TestElement', '');
  LDocument.DocumentElement := LNode;

  { Display document content. }
  Writeln(LDocument.XML.Text);
end;

Uses