XQuery Reference

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

XQuery Namespace Conventions

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:

 


xs:

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

 


xf:

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:

<l>{

for $tok in xf:tokenize("Jane fell down the hill", "\s")

return <i>{ $tok }<i>

}</l>

 


op:

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-xf:

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>


  Back to Top       Previous  Next