[jdom-interest] Differences between SAXBuilder.build and DOMBuilder.build

Alex Rosen arosen at silverstream.com
Wed Jul 25 13:25:11 PDT 2001


> > Why is that DOMBuilder does not have methods for building
> > documents from
> > Readers like SAXBuilder has?
>
>
> Because DOMBuilder is MUCH slower than SAXBuilder, and it
> should really only
> be used if you are converting from DOM to JDOM. In every other case
> (readers, files, etc), going SAX is faster.

In fact, I really think we should remove the methods that build from an
InputStream, File, and URL from DOMBuilder. This will reduce the chances
that people will use DOMBuilder instead of SAXBuilder. I can imagine
people not reading the doc carefully, and then get discouraged because
it's so slow. The methods say that they're useful for debugging - does
this mean for debugging the DOMBuilder implementation? If so, they
really don't belong in the public API. (If someone really needs to do
this, for some reason, they can always use JAXP to parse the file into a
DOM tree theirself, and then use DOMBuilder on that.)

Alex




More information about the jdom-interest mailing list