XIncProc XPointer Processor >

API Usage

Here a simple example of XIncProc XPointer Api Usage

The expression to find node "genre" with XPointer Framework is very simple: "bk101" (see Shorthand Pointer)

Code to find "genre" node with XPointer engine is as simple as this:

  1. Instanciate a XPointerEngine:
                    XPointerEngine xPointerEngine = new XPointerEngine();
  2. Execute parsing on the engine (first arg. is xpointer expression, second arg. is SAXSource):
                    String result = xPointerEngine.execute("bk101", source);

And result will be <genre id="bk101">Computer</genre>

The document used in the sample :

                <book >
                    <author>Gambardella, Matthew</author>
                    <title>XML Developer's Guide</title>
                    <genre id="bk101">Computer</genre>
                    <description>An in-depth look at creating applications
                        with XML.</description>

Further Details