# 22. Virtuoso Functions Guide - xml_tree_doc

Chapter Contents | Prev | Next
Keyword Search:
www.openlinksw.com
docs.openlinksw.com
Book Home
Contents
Preface
Virtuoso Functions Guide
Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web Server & Internet
XML
xmlagg
xmlattributes
xmladdattribute
xmlappendchildren
xmlconcat
xmlelement
xmlforest
xmlinsertafter
xmlinsertbefore
xmlreplace
xmltype.xmltype
xmltype.createnonsch...
xmltype.createschema...
xmltype.createxml
xmltype.existsnode
xmltype.extract
xmltype.getclobval
xmltype.getnamespace
xmltype.getnumval
xmltype.getrooteleme...
xmltype.getschemaurl
xmltype.getstringval
xmltype.isfragment
xmltype.isschemabase...
xmltype.isschemavali...
xmltype.isschemavali...
xmltype.schemavalida...
xmltype.setschemaval...
xmltype.toobject
xmltype.transform
xmlupdate
xper navigation
createxml
isentity
serialize_to_utf8_xm...
tidy_html
tidy_list_errors
updatexml
xml_add_system_path
xml_auto
xml_auto_dtd
xml_auto_schema
xml_create_tables_fr...
xml_cut
xml_doc_output_optio...
xml_get_system_paths
xml_load_mapping_sch...
xml_load_schema_decl
xml_namespace_scope
xml_persistent
xml_template
xml_tree
xml_tree_doc
xml_tree_doc_media_t...
xml_uri_get
xml_validate_dtd
xml_validate_schema
xml_view_dtd
xml_view_schema
xmlsql_update
xpath_eval
xper_cut
xper_doc
xper_locate_words
xpf_extension
xpf_extension_remove
xquery_eval
xslt
xslt_format_number
xslt_sheet
xslt_stale
xte_head
xte_node
xte_node_from_nodebl...
xte_nodebld_acc
xte_nodebld_final
xte_nodebld_init
xtree_doc
XPATH & XQUERY
Functions Index

## xml_tree_doc

returns an entity object given a tree from xml_tree
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. redundand 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

SQL State | Error Code | Error Text | Description
--- | --- | --- | ---

Examples
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
      )
    );

See Also

xtree_doc

xper_doc

xml_tree

xslt

xml_uri_get