TXMLDocument xml declaration (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example uses the following properties: Version, Encoding, and StandAlone.

Code

procedure Test_Declaration;
var
  LDocument: IXMLDocument;
begin
  LDocument := TXMLDocument.Create(nil);
  LDocument.LoadFromXML
    ('<?xml version="1.0" encoding="UTF-16" standalone="yes"?>' +
    '<TestElement>Inner text</TestElement>');

  { Display document version, encoding and stand-alone properties. }
  Writeln('Version: ' + LDocument.Version);
  Writeln('Encoding: ' + LDocument.Encoding);
  Writeln('StandAlone: ' + LDocument.StandAlone);
end;

Uses