Chapter 5. XPath in Action
Taken on its own terms, as a teaching tool, XPath might not seem to meet the test for a practical standard: it’s useful only in the context of some other standard. How do you demonstrate something like XPath without requiring the novice to learn that other standard as well? Luckily, several tools have emerged to simplify this task. These tools allow you to enter and modify an XPath expression — typically, a full location path — returning to you in some highlighted form a selected portion of a target document. (The portion in question might or might not be contiguous, of course, depending on how exotic the location path is.) In this chapter, I’ll demonstrate XPath using a tool called XPath Visualiser, developed by Dmitre Novatchev.
XPath Visualiser can be downloaded from the VBXML site, at http://www.vbxml.com.
XPath Visualiser: Some Background
XPath Visualiser runs under Microsoft Windows, from Windows 95 on up, and is built on top of the Microsoft MSXML XML/XSLT processor included with the Internet Explorer browser. This operating environment for the tool implies some advantages and disadvantages to its use.
An important practical advantage of this tool is that the results are visual. As we go through the examples in this chapter, you’ll be able instantly to see the effects — subtle or grand — of changes in XPath expressions. (You don’t even need to use Windows, let alone XPath Visualiser itself, because all these effects are captured in screen shots ...