Atomisation
Atomic values actually do not appear in XML documents. Rather, XML documents are presented in the XQuery data model as a tree of nodes. However, for calculating and for many functions atomic values are required. In order to easily organise this transfer, XQuery uses at many points a procedure which is called "atomisation" (although the result is not atomic, but a sequence). During the atomisation, the appropriate atomic values are "automatically" extracted from nodes. If a sequence of values and nodes is atomised, this is done as follows:
- Atomic values remain unchanged.
- Nodes are replaced by their typed values.
For example, atomisation is used in arithmetic expressions, in certain comparative expressions, in cast expressions and applied to arguments and return values of functions if they are atomic types. Therefore, the value of the following expressions is the same (the typed value of an element is its content; attributes are not taken into account):
xs:integer(<shoeSize>42</shoeSize>)
xs:integer("42")
<roomNumber>42</roomNumber> cast as xs:integer
fn:distinct-values((<A>42</A>,<B x="2">42</B>))
Source: "XQuery – Grundlagen und fortgeschrittene Methoden", dpunkt-Verlag, Heidelberg (2004)
<< back | next >> |