XmlSetOption Function

Action

Allows enabling/disabling different XML parsing options.

Include file

XmlAPI.bdh

Syntax

XmlSetOption( in nOption : number,
              in bValue  : boolean ): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
nOption

Option that should be either enabled (true) or disabled (false). Current option values are:

  • XML_OPT_RESOLVE_HREF (default: disabled) If enabled, XML items that are referenced with an href tag will be replaced with the referenced XML node.

  • XML_OPT_RESOLVE_EXTERNALS (default: disabled) If enabled, external referenced documents will be resolved.

  • XML_OPT_PRESERVE_WHITESPACE (default: disabled) If enabled, white spaces will be preserved when parsing XML content.

bValue True to enable the option, false to disable it.

Example

dcltrans
  transaction TMain
  var
    hDocument  : number;
    sXmlString : string;
  begin
    XmlSetOption(XML_OPT_PRESERVE_WHITESPACE, true);
    hDocument := XmlCreateDocumentFromXml("<root>          <child1 attr1='avalue1'>childvalue1</child1>"
                                           "<child2 attr1= 'avalue2'>childvalue2</child2></root>");
    XmlGetXml(hDocument, sXmlString);
    writeln(sXmlString);
  end TMain;