XIncProc XInclude Processor >

API Usage

Here a simple example of XIncProc XInclude 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. Set a source into an InputStream (source including xinclude instructions of course) :
                InputStream sourceStream = new FileInputStream(...);
  2. Call a parse function that resolve xinclude instructions into a new outputstream. NB: The source's base URI is needed for xml:base fixup.
                XIncProcEngine.parse(sourceStream, baseUri, outputStream);
    Et voila !

For example, that source document :

    <x xmlns:xi="">
        <xi:include href="include1.xml"/>

including this document:


The parsed result document will be this:

    <?xml version="1.0" encoding="UTF-8"?><x>
    <foo xml:base="include1.xml"/>