Search code examples
javaxmlxerces

simple example to use Xerces XNI?


Is there a simple example somewhere of using Xerces XNI? I'm looking at the sample code and can't make heads or tails of what it's doing, and don't want to just cut & paste into my application. For example, I can't figure out how to create an instance of org.apache.xerces.xni.parser.XMLDocumentSource.


Solution

  • org.apache.xerces.xni.parser.XMLDocumentSource is an interface, so the simple answer is that you'd create a class implementing that interface. Unless you actually want to hack Xerces itself for some reason, you probably don't need to bother with XNI.

    What is it that you want to do?

    There is no need for an XML application programmer to learn XNI if they only intend to interface to the Xerces2 parser using standard interfaces like JAXP, DOM, and SAX (http://xerces.apache.org/xerces2-j/xni.html)

    You may get more mileage from looking at javax.xml.parsers in http://download.oracle.com/javase/6/docs/api/