Representation as trees
In mathematics, a tree is an undirected graph in which any two vertices are connected by exactly one simple path. Any connected graph without simple cycles is a tree. A tree data structure simulates a hierarchical tree structure with a set of linked nodes. A hierarchy consists of an order defined on a set. The term hierarchy is used to stress a hierarchical relation among the elements. The XML specification defines an XML document as a well-formed text if it satisfies a list of syntax rules defined in the specification. This specification is long, however 2 key points relating to the tree structure of an XML document are: * The begin, end, and empty-element tags that delimit the elements are correctly nested, with none missing and none overlapping * A single "root" element contains all the other elements These features resemble those of trees, in that there is a single root node, and an order to the elements. XML has appeared as a first-class data type in other languages. The JavaScript (E4X) extension explicitly defines two specific objects (XML and XMLList), which support XML document nodes and XML node lists as distinct objects and use a dot-notation specifying parent-child relationships. These data structures represent XML documents as a tree structure. An XML Tree represented graphically can be as simple as an ASCII chart or a more graphically complex hierarchy. For instance, the XML document and the ASCII tree have the same structure. XML Trees do not show the content in an Instance document, only the structure of the document. In this example Product is the Root Element of the tree and the two child nodes of Product are Name and Details. Details contains two child nodes, Description and Price. The tree command in Windows and *nix also produce a similar tree structure and path.XPath Data Model
XPath Data Model terminology
The XPath Data Model is a long specification, and goes into many features unrelated to XML trees. Listed below are key terms from that specification and the XML specification. ;Instance: The data model represented as a sequence. ;Instance document: A document using and conforming to the same sequence/XML tree. ;Sequence: An order collection of zero or more items. A sequence cannot be a member of a sequence. A single item appearing individually is modeled as a sequence containing one item. ;Element: A node within the sequence that may contain ;Node: Any item represented in the XML tree/sequence. ;Root Node: The topmost element of the tree. All other elements and nodes must be contained within the root node. ;Item: A node or an atomic value. ;Value space: The part of an item that contains data rather than additional elements. ;Atomic type: A primitive simple type or a type derived by restriction from another atomic type. ;Atomic value: A value contained in the value space that is an atomic type. ;QName: The qualified name of an element. It must conform to naming rules of XML objects. (i.e. must start with a letter or underscore, case-sensitive, cannot start with the letters xml(in any case), can contain letters, digits, hyphens, underscores, and periods, cannot contain spaces.) ;Expanded-QName: The fully qualified name of an element. It may include a prefix and namespace. It must include the local name of the element. Within a given tree, document order satisfies the following constraints: * The root node is the first node. * Every node occurs before all of its children and descendants. * Namespace Nodes immediately follow the Element Node with which they are associated. The relative order of Namespace Nodes is stable but implementation-dependent. * Attribute Nodes immediately follow the Namespace Nodes of the element with which they are associated. If there are no Namespace Nodes associated with a given element, then the Attribute Nodes associated with that element immediately follow the element. The relative order of Attribute Nodes is stable but implementation-dependent. * The relative order of siblings is the order in which they occur in the children property of their parent node. * Children and descendants occur before following siblings.XML Information Set
XML Information Set terminology
The XML Information Set is a long specification, and goes into many features unrelated to XML trees. Listed below are the most important terms relating to XML tree terminology: "There is exactly one document information item in the information set, and all other information items are accessible from the properties of the document information item, either directly or indirectly through the properties of other information items. The document information item has the following properties: * hildren * ocument element * otations * nparsed entities * ase URI * haracter encoding scheme * tandalone * ersion * ll declarations processed There is an element information item for each element appearing in the XML document. One of the element information items is the value of the ocument elementproperty of the document information item, corresponding to the root of the element tree, and all other element information items are accessible by recursively following its hildrenproperty. An element information item has the following properties: * amespace name* ocal name* refix* hildren* ttributes* amespace attributes* n-scope namespaces* ase URI*Notes
{{DEFAULTSORT:Xml Tree XML