[jdom-interest] Xerces.jar too big [crimson]

philip.nelson at omniresources.com philip.nelson at omniresources.com
Sat Jun 30 06:17:55 PDT 2001


> Is it possible to use Crimson even when I have xerces.jar in 
> my classpath?
> What class name should I pass to SAXBuilder's constructor?
> 

This should probably be a FAQ because finding the information is not obvious
at all.  Yes it's possible both with JAXP and separately.  The simplest way
if you have the opportunity to edit your code is just give the class name
explicitly to SAXBuilder.

SAXBuilder builder = new
SAXBuilder("org.apache.crimson.parser.XMLReaderImpl", false);

Or you can not specify a class in the constructor, have JAXP in your
classpath and put this on your command line

java
-Djavax.xml.parsers.SAXParserFactory=org.apache.crimson.jaxp.SAXParserFactor
yImpl yourclass

the default parser is determined by the static class method
javax.xml.parsers.SAXParserFactory.newInstance() and which one is returned
depends on who wrote the SAXParserFactory class and which one is first in
the classpath.

> By the way, there is a package called parser.jar, that comes with the
> Jakarta-Ant distribution. It contains the com.sun.xml.* 
> packages.  Is that
> an XML parser? Can it be used to build JDOM documents?

I believe thats the original Crimson parser before it was given to Apache,
ie projectX



More information about the jdom-interest mailing list