Creating Documents  «Prev 

Structure of XML Documents

XML documents form a tree structure that starts at "the root" and branches to "the leaves".

XML Tree Structure

  1. XML documents are formed as element trees.
  2. An XML tree starts at a root element and branches from the root to child elements.
  3. All elements can have sub elements (child elements):

Discerning structure and the Structure of sample documents


1) Examine this basic business letter.
Examine this basic business letter. What do you see in terms of structure? Remember that for this course, we are not concerned with the internal formatting of the document.

2) Basic way of structuring the data
One very basic way of structuring the data in the business letter.

3) An XML structure for the document could be written like this.
An XML structure for the document could be written like this (tags are in bold print to make them easy to see). This example shows proper, albeit general, structure. A more specific structure could bring even greater benefits. In the next example, we will add a great deal more specificity.

4) Same letter structured into more specific pieces of information
Same letter structured into more specific pieces of information. In this example, a lot more specifiy has been added. However this specifity requires much more work for the user, who will have to encode the letter.

5) XML code for the version of the business letter in the previous frame
XML code for the version of the business letter in the previous frame. Remember that XML is case-specific. You can choose to use any capitalization scheme you desire, but you must adhere to your choice strictly.

6) Document that is well formed but cannot be interpreted by a human
While the above is in fact a well-formed document strictly in a syntactical sense, it will mean nothing from a human point of view. What is the significance of Hrumph or bL?
You see that well-formedness is useless without a sensical structure ad humanly recognizable context.

7) One of the most appropriate examples of XML usage is describing elements in a product list or catalog.
One of the most appropriate examples of XML usage is describing elements in a product list or catalog.

8) The catalog data represented in XML.
The catalog data represented in XML

9) Documents that are well-formed create natural tree-like structures that stem from the root
Documents that are well-formed create natural tree-like structures that stem from the root. Consider the tree structure of the book catalog you just examined. This figure demonstrates one way in which you could represent this tree visually.