Name
doc — Returns data from XML doc other than the main source document.
Synopsis
node-set
doc
(
|
document_uri
varchar
) ; |
Description
The function tries to access an XML text at location specified by document_uri
.
If the document_uri
argument is node-set, not a string,
then a node-set is returned as if document() function is applied to string-value of the first node
of the node-set.
The result of call doc($uri) is similar to the call of function document() with default parameters:
document($uri, document-uri(.), 0, 'UTF-8', 'x-any', 'Include=ERROR IdCache=ENABLE')
I.e. the retrieved document should be XML or XHTML (but not an old-style HTML) in 'UTF-8' encoding, content language is 'x-any' (it means 'mix of words from various human languages'), DTD should be read but validation should be disabled; errors on including subdocuments should be reported as errors and thus should abort the processing; a dictionary of element's IDs should be created in order to support XQuery 'pointer operator'.
Parameters
document_uri
An absolute or relative URI that points to a well formed XML or HTML document. If the URI is relative, then the base URI of context node is used to convert the given URI into absolute one.
Return Types
Node-set
Errors
The function may signal variety of errors when it reads the requested document(s) from network or from local resources. It may even cause deadlocks e.g. if documents are retrieved from the Virtuoso's own webserver and these documents must be created on the fly from data that are locked by Virtuoso/PL procedure that invokes the XPATH processor.
Examples
Example 24.578. Simple reading of a standalone XML document
Read a standalone document from http://www.example.com/sales/prices.xml
doc("http://www.example.com/sales/prices.xml")