Name

xml_tree — Parses an XML fragment and returns the parse tree as nested vectors.

Synopsis

xml_tree ( in document varchar ,
  in parser_mode integer ,
  in base_uri varchar ,
  in content_encoding varchar ,
  in content_language varchar ,
  in dtd_validator_config varchar );
 

Description

This parses the argument, which is expected to be a well formed XML fragment and returns a parse tree as a structure of nested heterogeneous vectors.

Parameters

document

(mandatory) A well formed XML or HTML document

parser_mode

0, 1 or 2; 0 - XML parser mode, 1 - HTML parser mode, 2 - 'dirty HTML' mode (with quiet recovery after any syntax error)

base_uri

(optional) in HTML parser mode change all absolute references to relative from given base_uri (http://<host>:<port>/<path>)

content_encoding

(optional) string with content encoding type of <document> valid is 'ASCII', 'ISO', 'UTF8', 'ISO8859-1', 'LATIN-1'.

content_language

(optional) - string with language tag of content of <document>; valid names are listed in IETF RFC 1766, default is 'x-any' (it means 'mix of words from various human languages).

dtd_validator_config

configuration string for DTD validator, default is empty string meaning that DTD validator should be fully disabled. See Configuration Options of the DTD Validator for details.

Return Types

vector of vectors representing the parsed tree of XML.

Examples

Example 24.517. Making an XML tree

declare tree any;

tree := xml_tree (file_to_string ('doc.html'), 1,
                'http://localhost.localdomain/', 'ISO');
...
tree := xml_tree (file_to_string ('doc.xml'));