![]() ![]() ![]() ![]() ![]() ![]() |
This chapter provides descriptions of the XQuery node 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 XQuery Node Functions Reference
This section provides descriptions of the XQuery node 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 node functions available from the mapper functionality:
If a $node-var
is not a node, 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 node-kind invocation: expected type node, given type
[string@http://www.w3.org/2001/XMLSchema]
If the value of $node-var
is the empty sequence, 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 node-kind invocation: expected type node, given type empty
The empty sequence is a sequence containing zero items ()
, which is similar to null in SQL.
xf:
node-kind(xf:
node $node-var)
—>xs:
string
Returns a string which represents the kind of $node-var
. One of the following strings will be returned: document, element, attribute, text, namespace, processing-instruction, or comment.
When you invoke the following query:
return <type>{xf:node-kind($x)}</type>
The following result is generated:
When you invoke the following query:
return <type>{xf:node-kind($x/@a)}</type>
The following result is generated:
When you invoke the following query:
return <type>{xf:node-kind($x/text())}</type>
The following result is generated:
W3C node-kind function description.
Returns the expanded QName of $node-var
. An expanded
QName contains a namespace URI and a local name.
If the value of $node-var
is the empty sequence, the following error message is displayed:
Error occurred while executing XQuery: Error loading the XQuery or XSLT for this method:
Type error in function node-name invocation: expected type node, given type empty
The empty sequence is a sequence containing zero items ()
, which is similar to null in SQL.
If a $node-var
is not a node, 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 node-name invocation: expected type node, given type
[string@http://www.w3.org/2001/XMLSchema]
xf:
node-name(xf:
node $node-var)
—> xs:
QName?
Returns the expanded QName of $node-var
. An expanded
QName contains a namespace URI and a local name.
Returns the empty sequence for nodes that do not have names (document, text, processing-instruction, comment). The empty sequence is a sequence containing zero items (), which is similar to null in SQL.
When you invoke the following query:
let $x := <elem xmlns:foo="http://www.acme.org/"><foo:subelem/></elem>,
$name := xf:node-name(children($x))
xf:get-namespace-from-QName($name)
xf:get-local-name-from-QName($name)
The preceding query generates the following result:
<?xml version="1.0" encoding="UTF-8"?>
<uri>http://www.acme.org/</uri>
W3C node-name function description.
Returns the local name (as a string) of $node-var
.
xf:
local-name(xf:
node? $node-var)
—> xs:
string
Returns the local name (as a string) of $node-var
.
The following XML document defines the namespace called xacme
:
<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 returns the local part of the URI/local name pair as shown in the following XQuery code:
let $a := <mydoc xmlns:xacme="http://www.acme.com/foo"> <xacme:n/> </mydoc>
return <name>{xf:local-name($a/*[1])}</name>
The preceding query generates the following result:
W3C local-name function description.
![]() ![]() ![]() |