• +49-(0)721-402485-12
Ihre Experten für XML, XQuery und XML-Datenbanken

Namespace nodes

Namenspace nodes represent the namespaces known in the respective context. The textual value of a namespace node is the related URI. The typed value results from the textual value by conversion to xdt:untypedAtomic.

Also a namespace node can be generated by a computed constructor. The key word namespace is followed by the assigned prefix and an expression in an evaluation context for the calculation of the URI of the namespace. A node for the default namespace (without prefix) cannot be generated in this way.

Namespace nodes are also generated implicitly. Each element node receives for each xmlns attribute in its direct element constructor an appropriate namespace node as child. In addition, there are children for all namespace nodes of surrounding element constructors. For each further known namespace used in the element name or its attributes, a child is also generated. Moreover, each element node receives a namespace node for the xml namespace.

However, namespace nodes cannot be explicitly accessed in XQuery.

Nodes for processing instructions

Processing instructions consist of a target and a content. Their textual value corresponds to the content, their typed value to the textual value.

A processing instruction can be generated with a direct constructor which, in turn, uses the XML syntax:

<?example this is the content?>

Alternatively, a computed constructor can be used. It consists of the key word processing-instruction followed by the target of the processing instruction. The processing instruction can be indicated as a constant QName or an expression in an evaluation context. Then, the content as expression in an evaluation context follows.

These expressions are subject to the automisation:

processing-instruction example {"this is the content"}

Comment nodes

A comment node corresponds to a comment in a XML document. The textual value of a comment node consists of the content of the comment, the typed value, too (as value of xs:string type). Also for comment nodes a direct constructor exists which uses the XML syntax:

<!-- This is a comment. -->

There is also a computed constructor: the key word comment followed by an expression in an evaluation context.

comment {"This is a comment."}

Here too, the result of the expression evaluation is subject to the atomisation. It should be noted that a comment node must not be mistaken for a XQuery comment!

Text nodes

A text node corresponds to the simple content of an element independently of its type. There is a direct constructor for text nodes which uses the CDATA syntax from XML:

<![CDATA[This is the content of the text node.]]>

The characters between [ and ] are not evaluated. This means, for example, that angle brackets in this part are not recognised as XML markup. The CDATA notation does not mean that also in the result a CDATA section must appear. Instead, a text node is generated here whose later depiction (serialisation) is not predetermined.

In additon, there is a computed constructor consisting of an expression in an evaluation context which follows the key word text. The result of this expression is atomised. If this results in an empty sequence, no text node is generated.

text {"This is the content of the text node."}

 

Source: "XQuery – Grundlagen und fortgeschrittene Methoden", dpunkt-Verlag, Heidelberg (2004)

<< backnext >>