Andy Clark wrote:
> 
> I'm working on writing some custom parser configurations and
> I am running into the same problem again and again: how to take
> advantage of the JAXP implementation to automatically create
> DOM and SAX parsers that use *my* configuration instead of the
> standard Xerces configuration WITHOUT rewriting or copying (and
> modifying) any JAXP code.
> 
> So I made the attached changes to my local copy of Xerces2 to
> implement a similar mechanism to what our JAXP implementation
> does. I copied (and renamed) our javax.xml.parsers.FactoryFinder
> class to org.apache.xerces.util.ObjectFactory so that we have a
> generic tool for dynamically instantiating classes. (Remember
> that this code works the "correct" way for both Java 1.1 and
> Java 2.)
> 
> Then I changed the parser code to use this factory to create
> JAXP factories *and* for the Xerces parsers in creating the
> default parser configuration that they use. I do this by adding
> a new file in the META-INF/services directory. In this way, if
> you write a new custom configuration you can override the
> default Xerces configuration simply by changing the parser
> configuration specified in this file.
> 
> I've used it for my own parser configurations and it works
> like a champ! But I would like someone to review my changes
> before I commit them to the CVS repository.

So far I've just done a quick scan and I need to go to a dr appt now so
I'll think about it some more later.  One comment is that the main
source for the javax.xml.parsers code actually lives in xml-commons. 
This allows other parsers to share that code easily.  Your changes
create a Xerces2 specific version with a dependency on Xerces2 code
which would make maintenance more difficult.

-Edwin

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to