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
Phrases
RDF data
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
VAD
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web & Internet
XML
XPATH & XQUERY
and
append
assign
avg
boolean
ceiling
concat
contains
count
create-attribute
create-comment
create-element
create-pi
current
distinct
doc
document
document-literal
empty
ends-with
every
except
false
filter
floor
fn:collection
for
format-number
function-available
generate-id
id
if
intersect
is_after()
is_before()
key
lang
last
let
list()
local-name
max
min
name
namespace-uri
normalize-space
not
number
or
position
processxquery
processxslt
processxsql
progn()
replace()
round
serialize
shallow
some
starts-with
string
string-length
substring
substring-after
substring-before
sum
system-property
text_contains()
translate
true
tuple()
union
unordered
unparsed-entity-uri
urlify
xmlview

Functions Index

doc

Returns data from XML doc other than the main source document.
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
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")
See Also

document()

document-literal()

xtree_doc()

xper_doc()