Types of Nodes in XPath
- XPath, consists of seven kinds of nodes:
- Element
- Attribute
- Text
- Namespace
- Processing-instruction
- Comment
- Document nodes
Xpath Example
XML Document
<?xml
version="1.0" encoding="IS0-8859-1"?>
<bookstore>
<book>
<title lang="en">web
Technologies</title>
<author>Kogent</author>
<year>2010</year>
<price>300.00</price>
</book>
</bookstore>
- Nodes in the above XML document :
- <bookstore> (root element node)
- <author> Kogent </author> (element node)
- lang=”en” (attribute node)
Relationships of Nodes
There
are five types of relationships amongst nodes:
- Parent
- Child
- Sibling
- Ancestor
- Descendant