XML technologies / XSLT / Introduction to XSLT 2.0 / Getting started with XSLT and XPath / The XML document as a tree / Parents and children in a tree diagram
(Excerpt from "XSLT 2.0 & XPath 2.0" by Frank Bongers, Chapter 1.)
Comparing an XML document’s source text with its tree representation shows that, in nodes representing elements, the container’s start and end tags coincide. An element’s content becomes a branch descending from that node, which may itself contain further nodes.
A node represents both the start and end tag together. As a conceptual unit, an element node removes the spatial separation of those tags in the serialized source. They can be regarded as written simultaneously; content is attached to nodes rather than inserted into containers.
Nodes directly connected by a branch have a parent-child relationship: the contained node is the child node (child) of the node it descends from; that node is its parent node (parent). The element <element_1> is a child node of <root> and itself has a text node as a child. <element_3> has three child nodes: two text nodes and an element node <sub_element>, which itself has a text node as a child. All of an element node’s content is represented in the tree by its children and their descendants (shown in dark grey for <element_3>; see the following figure).
Figure: Parent-child relationships in a tree diagram.
Copyright © Galileo Press, Bonn 2008
You may print the online version for your private use.
Otherwise, this chapter from "XSLT 2.0 & XPath 2.0 ― Das umfassende Handbuch" is subject to the same terms as the printed edition: the work and all its parts are protected by copyright. All rights are reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
Galileo Press, Rheinwerkallee 4, 53227 Bonn