Namespaces provide a mechanism to uniquely distinguish names used in XML documents. The W3C uses by convention the following namespace prefixes to identity W3C XQuery data types (xs:), functions (xf:), and operations (op:). In addition, BEA has defined the bea-xf: namespace to uniquely identify additional BEA supplied functions and data types. These XQuery namespace prefixes are used in the XQuery function signatures as shown in the examples provided in the following sections. This section provides information about the following XQuery namespace prefixes:
XML Schema datatypes and the constructors that construct these datatypes belong to the XML Schema namespace. The XML Schema namespace is identified by the following URI:
http://www.w3.org/2001/XMLSchema
The xs: namespace prefix is associated (by convention) with this namespace URI.
For example, when specifying the XML Schema data type string in a function signature, the xs: namespace prefix precedes string in the $string-var argument definition, as shown in the following example function signature:
bea-xf: trim-left(
xs:
string $string-var)
—> xs:string
W3C XQuery functions belong to the xquery functions namespace. The xquery functions namespace is identified by the following URI:
http://www.w3.org/2002/08/xquery-functions
The xf: namespace prefix is associated (by convention) with this namespace URI.
For example when invoking a W3C function in an query, prefix the function name with the string xf:
as shown in the following example query:
for $tok in
xf:
tokenize("Jane fell down the hill", "\s")
W3C XQuery operators belong to the xquery operators namespace. The xquery operators namespace is identified by the following URI:
http://www.w3.org/2002/08/xquery-operators
The op: namespace prefix is associated (by convention) with this namespace URI.
For example when invoking a W3C operation in an query, prefix the function name with the string op: as shown in the following example query:
<num_days>{get-days-from-dayTimeDuration(op:subtract-dates(date("2002-08-30"),date("2001-08-30")))}</num_days>
BEA XQuery functions belong to the bea xquery functions namespace. The bea xquery namespace is identified by the following URI:.
http://www.bea.com/2002/xquery-functions
The bea-xf: namespace prefix is associated (by convention) with this namespace URI.
For example when invoking a BEA function in an query, prefix the function name with the string bea-xf:
as shown in the following example query:
<result>{
bea-xf:
trim-left(" abc ")}</result>