YouTip LogoYouTip

Xml Tree

# XML Tree Structure * * * An XML document forms a tree structure, starting from the "root" and extending to the "leaves". * * * ## An XML Document Example XML documents use simple, self-descriptive syntax: ToveJaniReminderDon't forget me this weekend! The first line is the XML declaration. It defines the XML version (1.0) and the encoding used (UTF-8: Unicode, capable of displaying various languages). The next line describes the document's **root element** (as if saying: "This document is a note"): The following four lines describe four **child elements** of the root (to, from, heading, and body): ToveJaniReminderDon't forget me this weekend! The last line defines the end of the root element: You can assume that, from this example, the XML document contains a note written by Jani to Tove. XML is highly self-descriptive β€” do you agree? * * * ## XML Documents Form a Tree Structure An XML document must contain a **root element**. This element serves as the parent of all other elements. Elements in an XML document form a document tree. This tree starts at the root and extends downward to the deepest level. All elements may have child elements: ..... Terms such as parent, child, and sibling are used to describe relationships among elements. A parent element contains child elements. Child elements at the same level are siblings (brothers or sisters). All elements may have text content and attributes (similar to HTML). * * * ## Example: ![Image 2: DOM node tree]( The above image represents the book described in the following XML: ## XML Document Example Everyday ItalianGiada De Laurentiis200530.00Harry PotterJ K. Rowling200529.99Learning XMLErik T. Ray200339.95 In this example, the root element is ``. All `` elements in the document are contained within `<bookst
← Xml SyntaxXml Usage β†’