A common and important use of XPath involves being able to access elements—or, more precisely, element nodes. XPath provides ways to select element nodes either by their relationship to another node or by name.
Consider a source document of the following structure:
<report> <author>John Smith</author> <date>2002/12/19</date> <title>Safety Assessment for Greenland Tropical Tours</title> <chapter number="1">Some text</chapter> <chapter number="2">Some text</chapter> <chapter number="3">Some text</chapter> <appendix>Some appendix stuff</appendix> </report>
You can select all the child element nodes of the report element node by the following XPath location path:
The / at the beginning of the location path indicates ...