O'Reilly logo

XML Parsing with PHP by John M. Stokes

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Introduction to XPath

What is XPath?

Officially, XPath is a “query language” for XML. Let’s clarify exactly what that mean.

XPath is a sometimes cryptic string of characters we can use to search and extract data from XML documents with a great deal of specificity. If you are familiar with regular expressions, XPath is similar in concept—though not in syntax—in that you can build up powerful queries by putting together path expressions. This chapter introduces XPath concepts, although we won’t see how they look in PHP code until later chapters.

XPath is short for XML Path Language and was originally recommended by the W3C on November 16, 19991. It has since been revised, and the recommendation for XPath 2.0 was formalized December 14, 2010

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required