Before you start
Learn what to expect from this tutorial and how to get the most out of it.
This tutorial details the XPath specification, which allows you to specify particular sections of an XML document using a directory-like syntax. You'll learn the syntax of XPath, and you'll work with tools that let you experiment with XPath. By the time you complete this tutorial, you'll be well beyond the basics of XPath, and you'll understand predicates, more complex matching, and how to use XPath in your own applications.
Part 2 of this tutorial focuses on using predicates and predicate matching in your XPaths. It covers the various selectors XPath provides for being as specific or generic in a search as you like. It also shows you how to build complex predicates into a SQL-like set of queries, all using only standard XPath syntax.
You'll begin to understand the ideal applications of XPath, and you'll know when XPath is best used alongside another XML technology such as XQuery. Finally, you'll see how XPath deals with data types, particularly when you perform comparisons of attribute values to numeric values.
The most important prerequisite to this tutorial is that you thoroughly read and work through Part 1 (see Resources). That tutorial covers all the basics of XPath, and it includes a detailed discussion of nodes and the piece-by-piece evaluation that XPaths are handled with. Make sure you're familiar with all of that before you start Part 2.
Additionally, this tutorial is written for XML document authors and programmers. You should be familiar with and comfortable reading, writing, and manipulating XML. You should also be familiar with XML concepts, including the following:
- Elements
- Attributes
- Text
- The root element
Familiarity with the Document Object Model (DOM) is helpful for an understanding of nodes, but is not required. If you want to read up on the DOM, visit Resources to find several relevant links. You should also make sure you're comfortable with the section on nodes from Part 1 of this tutorial.
This tutorial will mention several other APIs and specifications as well, including XSL, XSLT, and XPath. Knowledge of any of these is helpful, but not required. For more information on any of these, consult Resources in the tutorial.


