XML tree structure

Source: Internet
Author: User
The XML document forms a tree structure that starts from & quot; Root & quot; and then expands to & quot; branches & quot ;.

An XML document instance

XML documents use simple self-descriptive syntax:

 
 
  
   Tove
  
  
   Jani
  
  
   Reminder
  Don't forget me this weekend!
 

The first line is the XML declaration. It defines the XML version (1.0) and the encoding used (ISO-8859-1 = Latin-1/Western European character set ).

The following line describes the root element of the document (for example, "This document is a note "):

 

The following four lines describe the four child elements (to, from, heading, and body) of the root ):

 
  Tove
 
 
  Jani
 
 
  Reminder
 Don't forget me this weekend!

The last line defines the end of the root element:

 

Assume that the XML document contains a token for Jani to write to Tove.

XML has excellent self-description. do you agree?

XML documents form a tree structure

The XML document must contain the root element. This element is the parent element of all other elements.

The elements in the XML document form a document tree. The tree starts from the root and expands to the bottom of the tree.

All elements can have child elements:

 
  
   
    .....
   
  
 

Terminologies such as parent, child, and compatriot are used to describe the relationship between elements. The parent element has child elements. Child elements at the same level become siblings ).

All elements can have text content and attributes (similar to HTML ).

Instance:

Represents a book in the following XML:

 
  
   Everyday ItalianGiada De Laurentiis
   
    2005
   
   
    30.00
   
  
  
   Harry PotterJ K. Rowling
   
    2005
   
   
    29.99
   
  
  
   Learning XMLErik T. Ray
   
    2003
   
   
    39.95
   
  
 

The above is the content of the XML tree structure. For more information, see The PHP Chinese website (www.php1.cn )!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.