In much the same way that SQL is used to query a relational database, XPath expressions can be used to query an XML document. While the W3C XPath standard is not meant to stand alone, any implementation of XSLT or XQuery requires an internal XPath processor. Since Oracle has exposed its XPath processor, you can use it for a variety of applications. The example framework presented in this chapter supports two specific applications that are quite common.To work with XML documents that are stored in your database, you need to be able to query them for information. One approach is to simply index them within your database; however, that is expensive. Another approach is to extract from the document, prior to or upon its insertion, key data that can be stored relationally and linked to the document itself through an ID. This results in far faster and more efficient queries.The second application enables you to process large XML documents that consist of repeating subtrees, which are quite common in database data. Instead of processing the document as a whole, this application enables you to split it based on an XPath and return a set of smaller documents that are easier to process.Both of these applications have in common the use of an XPath processor. The first application returns a set of values, the second a set of nodes. Therefore, your design must be able to handle both conditions. To do this, you will build a framework around the C++ XPath processor. For ease of testing, this framework will be packaged as a command-line utility, but it can easily be plugged into a larger application.