Chapter 16. XPath
Much of the code in this book has involved navigating the tree structure of an XML document to find particular nodes. For example, the XML-RPC servlet in Example 10.13 read a client request looking for int elements. Such code can become quite involved and fragile if you aren't very careful. As the code walks down the tree hierarchy, loading one child after the other, a single misplaced or misnamed element may cause the program to fail. If an element isn't where it's expected to be, then the chain of method calls that gives directions to the desired elements will be broken. What's needed is a way to specify which nodes a program needs without explicitly specifying how the program navigates to those nodes.
XPath is a fourth-generation ...
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