The following are Java examples that show how to manipulate XML data in a programming environment. All require a few Java archives which can be found in EXIST_HOME/lib.
  • SAX and DOM examples. A simple SAX example, and two very simple DOM programs. The SAX examples shows a content handler, and how to use it. The first DOM example serializes a DOM tree (don't use it in a real application!), and the second one modifies an XML document. See the comments. You must add the Xerces.jar archive in your CLASSPATH (look at EXIST_HOME/lib/endorsed).
  • The Xalan XSLT processor. The following example comes from the Xalan distribution. It shows how to apply an XSLT transformation to an XML document via the Xalan/Java API.
    You must add the xalan.jar, xercesImpl.jar, xml-apis.jar and serializer.jar archives in your classpath. See the Xalan site for further examples and explanations.
  • XML:DB (using eXist) examples. The following sample programs show how to access the eXist XML database. You must add the exist.jar, xmldb.jar, xmlrpc-1.2-patched.jar, and log4j-1.2.14.jar archives in your CLASSPATH. See the book appendix for further explanations, as well as the eXist documentation.
  • Lucene examples.
  • Hadoop MapReduce.
  • XProc.