Chapter 1. Introducing XPath and XPointer
The XPath and XPointer specifications promulgated by the World Wide Web Consortium (W3C) aim to simplify the location of XML-based content. With software based on those two specs, you’re freed of much of the tedium of finding out if something useful is in a document, so you can simply enjoy the excitement of doing something with it.
Before getting specifically into the details of XPath or XPointer, though, you should have a handle on some concepts and other background the two specs have in common. Don’t worry, the details — and there are enough, it seems, to fill a phone directory (or this book, at least) — are coming.
Why XPath and XPointer?
Detailed answers to the following questions are implicit throughout this book and explicit in a couple of spots:
Why should I care about XPath and XPointer? What do they even do?
To answer them briefly for now, consider even a simple XML document, such as this:
<house_pet_hazards> <hazard type="cleanup"> <name>hairballs</name> <guilty_party species="cat">Dilly</guilty_party> <guilty_party species="cat">Nameless</guilty_party> <guilty_party species="cat">Katie</guilty_party> </hazard> <hazard type="cleanup"> <name>miscellaneous post-ingestion surprises</name> <guilty_party species="cat">Dilly</guilty_party> <guilty_party species="cat">Katie</guilty_party> <guilty_party species="dog">Kianu</guilty_party> <guilty_party species="snake">Mephisto</guilty_party> </hazard> <hazard type="phys_jeopardy"> <name>underfoot ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access