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 )!