[jdom-interest] SAX Parsers

Brett McLaughlin brett.mclaughlin at lutris.com
Wed Jul 19 17:26:21 PDT 2000

"David W. Smiley" wrote:
> (1) What stance do the JDom developers take on the "Java API for XML Parsing" (javax.xml)
> released by Sun?  It appears to be a standardized way of getting the DOM.  The API seems
> to interfere / collide with the goals of SAX2 which also appears to be an emerging
> standard.

What? SAX 2 is a core part of JDOM's builders and outputters. And we
supersede JAXP. In fact, future versions of JAXP will almost certainly
include support for JDOM, as will the parser that makes its way into the
JDK, it looks like. So we're right on target there.

> (2) I hoped to use JDom without Xerces.  Since JDom needs SAX2, I downloaded the SAX2
> library.  http://www.megginson.com/SAX/Java/  However, my app won't run because JDom's
> SAXBuilder class refers to:
> org/xml/sax/ext/LexicalHandler
> which is not in the SAX2 library.

Even once you get the SAX extensions (where LexicalHandler is), you
can't use JDOM without a parser. SAX isn't a parser, it's an API, so you
need a parser from somewhere. Xerces is the best, Project X works as
well as Oracle V1 and V2.

> (3) I disagree with the constructors of SAXBuilder.  Its insistence that you must use a
> String representation of the class that implements the SAX2 Parser has caused me to make
> a dummy class that chooses the Parser I want and configures it.  (In particular what I
> want to do is set a dummy entity resolver for the parser that causes the behavior of
> setting the SAX2 Feature "http://xml.org/sax/features/external-parameter-entities" to
> false.)  So, would it be OK if the SAXBuilder had a constructor that took an instance of
> a SAX2 XMLReader class?

No - that requires users to know more than they need to about SAX, we
had decided. Setting an entity resolver, however, is something we will
let you do, so that solves your problem nicely. We'll also let you set
an Error Handler. That's more than JAXP does, btw ;-) And you would
still have to change system properties to use JAXP in the same way, so
that doesn't offer you any better alternatives.

Will that satisfy your needs? 


> Thanks in advance for any input on these questions.
> David Smiley
> The MITRE Corporation
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

Brett McLaughlin, Enhydra Strategist
Lutris Technologies, Inc. 
1200 Pacific Avenue, Suite 300 
Santa Cruz, CA 95060 USA 

More information about the jdom-interest mailing list