Chapter 9: XPath


Overview

XPath is a compact expression language to query XML documents. Most of the expressions you will find in XPath are simple to read and understand, even if you are not to use those libraries in your yet an XPath expert. This in part explains the success of the XPath language, which is already in wide use. Among other things, you can use XPath to extract information from an XML document, check the validity of a document, or perform complex queries on a document.

In the first section of this chapter, you learn about some of the major features of the XPath expression language. After reading this section, you will be able to understand most XPath expressions and write your own expressions.

If you are already an XPath expert, you can jump directly to the "Lessons from the Trenches" section. In this section, you will read some lessons that have been learned (often the hard way) over the years by programmers using XPath in real-life situations.

You need a special engine to run XPath expressions. Engines often come in the form of libraries, which you then use from a programming language. This chapter covers XPath libraries available in Java, .NET, and PHP, and shows you how programs.

As always, having the right tool makes a big difference. So the last section of this chapter tells you about some tools that will make your life easier when dealing with XPath expressions.




Professional XML
Professional XML (Programmer to Programmer)
ISBN: 0471777773
EAN: 2147483647
Year: 2004
Pages: 215

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net