In XPath, there are seven kinds of nodes: element, attribute, text, namespace, processing-instruction, comment, and document (root) nodes.
在XPath里,有7中不同的节点:元素,属性,文本,名称空间,处理指令,内容,文档(根目录root)节点。
In XPath, there are seven kinds of nodes: element, attribute, text, namespace, processing-instruction, comment, and document (root) nodes. XML documents are treated as trees of nodes. The root of the tree is called the document node (or root node).
在XPath里,有7中不同的节点:元素,属性,文本,名称空间,处理指令,内容,文档(根)节点,XML文档是节点树状结构。“树根”称作文档节点(或根节点)。
Look at the following XML document:
下面给出一个XML文档:
<?xml version="1.0" encoding="ISO-8859-1"?> <bookstore> <book> </bookstore> |
Example of nodes in the XML document above:
上述XML文档中的节点实例:
<bookstore> (document node) <author>J K. Rowling</author> (element node) lang="en" (attribute node) |
Atomic values are nodes with no children or parent.
“单元素”属性值只没有子节点和父节点。
Example of atomic values:
“单元素(Atomic)”属性值例子:
J K. Rowling "en" |
Items are atomic values or nodes.
项目是指单元素或节点。
Each element and attribute has one parent.
每个元素和属性都有一个“父类”。
In the following example; the book element is the parent of the title, author, year, and price:
在下面的例子里:book元素是title, author, year, 和 price元素的父元素。
<book> |
Element nodes may have zero, one or more children.
节点元素可拥有任意个数的子类。
In the following example; the title, author, year, and price elements are all children of the book element:
在下面例子里,title, author, year, 和 price元素都是book元素的子元素。
<book> |
Nodes that have the same parent.
拥有相同的父类的节点称之为同属类。
In the following example; the title, author, year, and price elements are all siblings:
在下面的例子里title, author, year, 和price元素都是“同属类元素”。
<book> |
A node's parent, parent's parent, etc.
一个节点的父类,父类的父类及更多称为该节点的祖类。
In the following example; the ancestors of the title element are the book element and the bookstore element:
在下面例子里,title元素的“祖类元素”是book元素和bookstore元素。
<bookstore> <book> </bookstore> |
A node's children, children's children, etc.
节点的子类,子类的子类及更多称为下属类。
In the following example; descendants of the bookstore element are the book, title, author, year, and price elements:
在下面的例子里,bookstore元素的下属类元素是book, title, author, year, 和price元素:
<bookstore> <book> </bookstore> |