XQuery Reference

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

XQuery QName Functions Reference

This chapter provides descriptions of the XQuery QName functions available in the mapper functionality of WebLogic Workshop. You use the mapper functionality to generate queries and to edit these queries to add invocations to these provided XQuery functions. To learn more,see Invoking Functions or Operators in a Query.

In addition to the XQuery functions and operators available in the mapper functionality, a larger set functions and operators is provided. You can manually add invocations to these functions and operators to queries in the Source View of the mapper functionality. For a list of these additional functions and operators, see the XQuery 1.0 and XPath 2.0 Functions and Operators - W3C Working Draft 16 August 2002 available from the W3C Web site at the following URL:

http://www.w3.org/TR/2002/WD-xquery-operators-20020816

This section lists the QName functions available from the mapper functionality:

 


xf: get-local-name-from-QName

Extracts the local part of the QName from $QName-var.

A QName(qualified name) is made up of a namespace name and a local part. The namespace name is the URI associated with the prefix of a namespace declaration.

If the value of $QName-var is the empty sequence, the empty sequence is returned. The empty sequence is a sequence containing zero items (), which is similar to null in SQL.

If a QName is not passed into $QName-var, the following error is displayed in the mapper:

Error occurred while executing XQuery: Error loading the XQuery or XSLT for this method:

Type error in function get-local-name-from-QName invocation:

expected type [QName@http://www.w3.org/2001/XMLSchema]?,

given type [string@http://www.w3.org/2001/XMLSchema]

Signatures

xf:get-local-name-from-QName(xs:QName? $QName-var) —> xs: string?

Table 10-1 Arguments
Data Type
Argument
Description
xs:QName
$QName-var
Represents the QName to extract from.

Returns

Returns the a string which contains the local part of the QName from $QName-var.

Examples
Simple

The following XML document defines the namespace called xacme:

<?xml version='1.0'?>

<mydoc xmlns:xacme="http://www.acme.com/foo">

<xacme:n/>

</mydoc>

The preceding XML Document associates the namespace prefix xacme to the URI: http://www.acme.com/foo. The string xacme:n is qualified name for the URI/local name pair:("http://www.acme.com/foo", "n").

The following example query calls the get-local-name-from-QName function:

<qname_example>

{xs:string(xf:get-local-name-from-QName(xf:expanded-QName("http://www.acme.com/foo", "n")))}

</qname_example>

The preceding query generates the following result:

<qname_example>n</qname_example>

Related Topics

W3C get-local-name-from-QName function description.

 


xf: get-namespace-from-QName

Extracts the namespace URI from $QName-var.

A QName (qualified name) is made up of a namespace name and a local part. The namespace name is the URI associated with the prefix of a namespace declaration.

If the value of $QName-var is the empty sequence, the empty sequence is returned. The empty sequence is a sequence containing zero items (), which is similar to null in SQL.

If a QName is not passed into $QName-var, the following error is displayed in the mapper:

Error occurred while executing XQuery: Error loading the XQuery or XSLT for this method:

Type error in function get-namespace-from-QName invocation:

expected type [QName@http://www.w3.org/2001/XMLSchema]?,

given type [string@http://www.w3.org/2001/XMLSchema]

Signatures

xf:get-namespace-from-QName(xs:QName $QName-var) —> xs: anyURI?

Table 10-2 Arguments
Data Type
Argument
Description
xs:QName
$QName-var
Represents the QName to extract from.

Returns

Returns the URI (of data type anyURI) of the namespace in $QName-var.

Examples
Simple

The following XML document defines the namespace called xacme:

<?xml version='1.0'?>

<mydoc xmlns:xacme="http://www.acme.com/foo">

<xacme:n/>

</mydoc>

The preceding XML Document associates the namespace prefix xacme to the URI: http://www.acme.com/foo. The string xacme:n is qualified name for the URI/local name pair: ("http://www.acme.com/foo", "n").

The following example query calls the get-namespace-from-QName function:

let $a := <mydoc xmlns:xacme="http://www.acme.com/foo"> <xacme:n/> </mydoc>

return

<name>{

xf:get-namespace-from-QName(xf:node-name($a/*[1]))

}</name>

The preceding query generates the following result:

<name>http://www.acme.com/foo</name>

Related Topics

W3C get-namespace-from-QName function description.


  Back to Top       Previous  Next