Element nodes

An element node encapsulates an XML element.

An element can have zero or one parent, and zero or more children. The children can include element nodes, processing instruction nodes, comment nodes, and text nodes. Document and attribute nodes are never children of element nodes. However, an element node is considered to be the parent of its attributes. The attributes of an element node must have unique QNames.

An element node has the following node properties:

  • node name
  • parent
  • type name (The type name of an element node in Db2 is always xs:untyped.)
  • children
  • attributes
  • string value
  • typed value
  • in-scope namespaces
For an element node, the string value is the concatenation of the string values of all of its text node descendants in document order. If the element is empty, the string value is the empty string "". The typed value of an element is one of the following values:
  • If the element can be null, the typed value is ().
  • If the element is empty, the typed value is the empty sequence ().
  • Otherwise, the typed value is its string value as type xs:untypedAtomic.

For example, suppose that a document has the following textual representation:

<product xmlns="http://posample.org" pid="100-101-01"> 
 <description>                                            
   <name>Snow Shovel, Deluxe 24"</name>                    
   <details>A Deluxe Snow Shovel, 24 inches wide, ergonomic
curved handle with D-Grip</details>                                    
   <price>19.99</price>                                    
   <weight>2 kg</weight>                                   
 </description>                                           
</product>

The product element node has the following property values:

Table 1. Properties of the product node
Node property Value Value type
node name product  
parent document node  
type name xs:untyped  
children description node  
attributes pid  
string value "Snow Shovel, Deluxe 24"A Deluxe Snow Shovel, 24 inches wide, ergonomic curved handle with D-Grip19.992 kg"  
typed value "Snow Shovel, Deluxe 24"A Deluxe Snow Shovel, 24 inches wide, ergonomic curved handle with D-Grip19.992 kg" xs:untypedAtomic
in-scope namespaces (default, http://posample.org)  

The name element node has the following property values:

Table 2. Properties of the name node
Node property Value Value type
node name name  
parent description node  
type name xs:untyped  
children text node "Snow Shovel, Deluxe 24" "  
attributes none  
string value "Snow Shovel, Deluxe 24" "  
typed value "Snow Shovel, Deluxe 24" " xs:untypedAtomic
in-scope namespaces (default, http://posample.org)