TXMLDocumentParseOptions (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following example uses the ParseOptions property.

Code

procedure Test_ParseOptions;
var
  LDocument: IXMLDocument;
begin
  LDocument := TXMLDocument.Create(nil);

  { Set parse options.
    This should be done before loading (and parsing) the document. }
  LDocument.ParseOptions := LDocument.ParseOptions + [poPreserveWhiteSpace];

  { Uncomment the following line to strip white spaces. }
  //LDocument.ParseOptions := LDocument.ParseOptions - [poPreserveWhiteSpace];

  LDocument.LoadFromXML
    ('<CloudType>       <Cirrocumulus />       </CloudType>');

  Writeln(LDocument.XML.Text);
end;

Uses