Take the 2-minute tour ×

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.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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/

share|improve this answer
OMG this is an old question. I have no idea what it was I was trying to do. In more recent projects I've always JAXP/DOM/SAX/StAX like you have mentioned. –  Jason S Nov 21 '11 at 22:09
:-D I was just browsing through unanswered questions. Didn't even look at the date. –  hcayless Nov 22 '11 at 0:08
add comment

Your Answer


