According to the W3C, XPath is a language for addressing parts of an XML document, designed to be used by both XSLT and XPointer. In this article we will learn about XPath, XPath expressions and how to use XPath in .NET and Java.
Introduction to XPath - Path Expression Syntax (Page 2 of 4 )
The basic path expression syntax is similar in style to file-system addressing. If the path starts with the slash ( / ), then it represents an absolute path to the required element. Only the / represents the root element. For the example above, the expression "/" represents <bookstore>. To get all the <book> elements use:
/book
This will return both <book> elements. To get the <price> elements use:
If the path starts with // then all elements in the document which fulfill the following criteria are selected. The //B expression selects all <B> tags regardless of their parents.