Writing XPath expressions

XPath describes a path through the XML document, similar to a path to a file on a disk. Consider the following piece of XML:
If we want to select the product elements in this XML document, we can use the following XPath expression:
The slash ( / ) at the beginning of the expression makes this an absolute path, starting at the document root. If we trace the path from the document root to the product nodes, we first encounter a catalog element and then the product element. Hence the XPath.