精彩专题推荐:建站之入门课 建站之必修课 建站之关键课 网站价值所在 流量提高专题 css+div 标准 个人网站打造全过程

xml 文档树

来源:网络翻译整理 时间:08-04-12 点击: 点击这里收藏本文

All elements can have sub elements (child elements):
文档中所有的元素都可以包含二级元素(即:子元素):

<root> <child> <subchild>.....</subchild> </child> </root>

The terms parent, child, and sibling are used to describe the relationships between elements. Parent elements have children. Children on the same level are called siblings (brothers or sisters).
这里提到的一些术语,如:父元素、子元素、同级元素使用与描述元素之间的相互关系的。父元素包含子元素;和子元素同级的称为同级元素(或兄弟、姐妹元素)。

All elements can have text content and attributes (just like in HTML).
所有的元素都包含文本内容和属性(这点和HTML极其类似)。


Example:
案例:

DOM node tree

The image above represents one book in the XML below:
上述图表代表了下述XML文档中的一本书:

<bookstore> <book category="COOKING"> <title lang="en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book> <book category="CHILDREN"> <title lang="en">Harry Potter</title> <author>J K. Rowling</author> <year>2005</year> <price>29.99</price> </book> <book category="WEB"> <title lang="en">Learning XML</title> <author>Erik T. Ray</author> <year>2003</year> <price>39.95</price> </book> </bookstore>

The root element in the example is <bookstore>. All <book> elements in the document are contained within <bookstore>.
案例中的根元素是<bookstore>。文档内所有的<book>元素都位于<bookstore>内。

The <book> element has 4 children: <title>,< author>, <year>, <price>.
与此同时,<book>元素还包含了4个子元素:<title>、< author>、<year>、<price>。

9 7 3 1 2 4 8 :

广而告之