freshidea - Fotolia

Manage Learn to apply best practices and optimize your operations.

Understanding and using XPath

Some discussion of XPath and a recommendation of a book that expands on this information.

XML Developer Tip
(Receive this column in your inbox,
click Edit your Profile to subscribe.)

Understanding and using XPath
Ed Tittel

In some of these tips, I occasionally review XML books, usually because they offer real value to XML developers and content creators. Here I go again in that same vein, this time for Steven Holzner's recently released book XPath Kick Start: Navigating XML with XPath 1.0 and 2.0, SAMS Publishing, Copyright 2004 (released December, 2003), ISBN: 0672324113; List Price $34.99. As one of the best writers on XML around, I've mentioned other Holzner books on general XML and XSLT in previous tips. This time, Holzner not only brings his extensive knowledge and experience to bear, he also includes lots of explanations for and examples of XPath, and how it relates to XSLT, XQuery, XPointer, XLink and the Document Object Model (DOM) level 3.

In a tight nutshell, XPath defines mechanisms whereby one XML document can reference and access contents of other XML documents. As the name of the specification indicates, XPath provides various methods to navigate a tree-structured representation of an XML document once it's been parsed and internalized within some kind of XML document handling tool or program. But XPath also permits document values to be identified, tested against predicates (logical constructs that test for specific values, instances, types of values, and so on), and extracted on demand. Thus it's not just a syntax to find one's way around XML documents; it's also a tool for testing and extracting values from such documents. As such, it's a key element in any XML developer's toolkit, given constant needs to locate, open, examine, and extract information from such documents.

Holzner not only covers the XPath 1.0 and 2.0 specifications and syntax, he also explains:

Along the way, you'll find explanations and examples (with running code available online: visit, then follow links to the XPath book and its download links*). The best part of these examples is that they not only illustrate XPath and related XML syntax, they also include references to external specs, namespaces, and other documents necessary to make this code work. As somebody who's had to learn other XML applications through trial and error with this all-important "supporting information," I see this as a real boon to those trying to experiment with and learn about such applications.

Definitely worth a look; check it out online*, or at your favorite bookstore!

*As I write this in late December, SAMS hasn't yet posted downloads or the online data for this book. But according to sources at Pearson (SAMS' parent company), this material should be available in early January.

About the Author

Ed Tittel is a VP of Content Development & Delivery at CapStar LLC, an e-learning company based in Princeton, NJ. Ed runs a small team of content developers and project managers in Austin, TX, and writes regularly on XML and related vocabularies and applications. E-mail Ed at

For More Information:

  • Looking for free research? Browse our comprehensive White Papers section by topic, author or keyword.

  • For insightful opinion and commentary from today's industry leaders, read our Guest Commentary columns.

  • Hey Codeheads! Start benefiting from these time-saving XML Developer Tips and .NET Developer Tips.

  • Visit our huge Best Web Links for Web Services collection for the freshest editor-selected resources.
  • Visit Ask the Experts for answers to your Web services, SOAP, WSDL, XML, .NET, Java and EAI questions.
  • Choking on the alphabet soup of industry acronyms? Visit our helpful Glossary for the latest industry lingo.
  • Couldn't attend one of our Webcasts? Don't miss out. Visit our archive to watch at your own convenience.
  • Discuss this article, voice your opinion or talk with your peers in the SearchWebServices Discussion Forums.

Dig Deeper on Topics Archive

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.