Jeff --

I'll chime in.

> I propose that it be made possible to configure Axis's
> DocumentBuilderFactory and SAXParserFactory independent of
> the system's default.  It is fine to use the default, but
> it would be nice to be able to override this behavior -
> especially when working with an older application server.

I think that your request is already allowed for by org.apache.axis.utils.XMLUtils, 
since this is the only place that the factories are used or set up.  You can simply go 
in and hard-wire the constructor(s) and rebuild axis.  For example, if you want to use 
Xerces-J2, then you want to replace:

        SAXParserFactory.newInstance()

with 

        new org.apache.xerces.jaxp.SAXParserFactoryImpl()

You will have to make a similar adjustment to the DOMBuilderFactory.  (This will open 
an interesting can of worms with respect to which DOM implementation and which SAX 
implementation are present.)

This may sound a little low-level at first, but it is really the best way to 
accomplish your goal.  Here are three reasons: (1) there is no pluggable alternative 
to JAXP other than to use implementation-specific classes. (2) Doing a Class.forName() 
or attempting to access a particular class by classloader (which is how most JAXP 
implementations do it -- see the xml-commons project: 

http://cvs.apache.org/viewcvs.cgi/xml-commons/java/external/src/javax/xml/parsers/FactoryFinder.java?rev=1.7.4.1&content-type=text/vnd.viewcvs-markup

) will introduce other interesting behaviors depending on the J2EE container.  (3) 
Overriding JAXP behavior for the container itself may (i.e., will) generate unexpected 
and undesirable results.

In the worst case, you can just be out of luck.

        -- Paul Brown
           FiveSight Technologies, Inc.

Reply via email to