Top

Name

xml_tree_doc — returns an entity object given a tree from xml_tree

Synopsis

xml_tree_doc ( in tree any ,
  in base_uri varchar );
 

Description

This returns an entity object given a tree of the form returned by xml_tree.

If it is given a string as an argument, it will automatically generate the parse tree and use it to make the entity instead requiring you to run the string through xml_tree first. Note that it is better to use xtree_doc or xper_doc for converting source XML text directly to an XML entity.

If the argument is an XML tree entity, the function will return it as is, so e.g. redundant calls of xml_tree_doc will have no effect. The only thing xml_tree_doc can alter in the returned value is base URI of the document entity: if base_uri is provided and is not NULL, and argument entity has no base URI set then the provided URI is assigned to the returned entity.

Any other type of argument is illegal, including XML persistent entity.

Parameters

tree

either an XML tree such as that returned by xml_tree(), or a string of XML data. If a string is provided then it will automatically generate the parse tree and form an entity instead of requiring you to run the string through xml_tree() first.

base_uri

Base URI of the original document, if known. It will be useful if the document is not "standalone" and some entity references are relative references to resources located "somewhere near" the "top-level" document passes as "tree" parameter.

Return Types

XML entity object

Errors

Table 24.130. Errors signalled by

SQL State Error Code Error Text Description
 

Examples

Example 24.518. Transforming an XML Document

declare doc_base varchar;
declare doc_tree any;

doc_base := 'virt://WS.WS.SYS_DAV_RES.RES_FULL_PATH.RES_CONTENT:/DAV/docsrc/';
doc_tree := xml_tree_doc(xml_tree(
    xml_uri_get(doc_base, 'virtdocs.xml')
      ), doc_base);

http_value(
  xslt('virt://WS.WS.SYS_DAV_RES.RES_FULL_PATH.RES_CONTENT:/DAV/stylesheets/html_chapter.xsl',
    doc_tree
  )
);