[jdom-interest] PATCH: JAXP Support

Jason Hunter jhunter at collab.net
Sun Jan 28 01:14:50 PST 2001

Here's a little background on the patch...

The model we're looking at here is that SAXBuilder (and later perhaps
DOMBuilder) will by default use the parser specified by JAXP.  This will
allow the SAX parser to be changed using standard JAXP techniques, no
recompiling necessary.  You'll of course be able to override the JAXP
behavior by specifying a parser class as a parameter to the SAXBuilder
constructor, just like always.  So if you just *love* Xerces you can
either make sure that's your JAXP parser of choice, or you can skip JAXP
and pass the Xerces parser class name to SAXBuilder.  Either way works.

If JAXP classes aren't found, then the default is Xerces.  I don't
believe JDOM should depend on JAXP if it doesn't have to, especially
when JAXP isn't open source.  Thus the reflection.

James is the spec lead on JAXP and has been using JDOM for some of his
own projects lately.  I encouraged him to send in this patch since he
knows more about JAXP than anybody.  :-)

If anyone has comments please send them to the list.


James Duncan Davidson wrote:
> The attached patch adds JAXP support to SAXBuilder.java. This is implemented
> using reflection so that you don't have to have JAXP in order to compile
> (though it makes for icky looking code :).
> One thing that should also be hit is that if the xerces parser isn't found,
> a JDOM exception saying "Can't find anyway to parse" should be thrown. I
> didn't think of that till just now, and it's late and I'm about to catch a
> plane so I'll leave that to you guys. :)
> .duncan

More information about the jdom-interest mailing list