Going Deep: The XPath Data Model
In the XPath view of things, elements, attributes, text, comments, processing instructions, and even namespaces are represented internally as nodes connected in a tree shape. Some nodes, such as elements, may have child nodes, while others, such as attributes, have no children, as restricted by XML rules. A special node, called the root node, serves as the ultimate ancestor node.
In this example, note that neither the XML declaration nor the
DOCTYPE declaration produce any nodes. Thus, these
XML data structures are effectively invisible to XPath and, by
extension, XForms. On the other hand, notice how each element node
namespace nodes attached: one for the
xmlns:html declaration on the root element, which
applies throughout, and one for the built-in declaration of the
xml prefix, as seen in the attribute
xml:lang. Even a short document ...