The structure of the path is simple—each entity in the hierarchy is identified by name, with the entity names separated by slashes. We find the requested entity by "walking" the path, locating the first entity, looking within the first entity to find the second entity, looking within the second to find the third, and so on.
The same basic idea applies to XPath. Take the following document:
To extract the mission status from this document, we can use the xpath expression
pl:mission/pl:status
which yields the "status" element
In this case, there was only one element matching the criteria expressed in the path, so only one element resulted from evaluating the expression. In other cases, however, an XPath statement may yield multiple elements. For instance, the expression
pl:mission/hi:astronaut
yields
which is a "nodeset" consisting of all the hi:astronaut elements in the document.
Note: The sample code in this tutorial makes use of the Tectonic programming language
(featured in the Delve SOA Fast-Prototyping Toolkit)
Not sure exactly what the heck XML is? Get started with this
excellent wikipedia article:
> Click Here!