ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Alberto Fernandez" <>
Subject RE: Selecting XML Parsers
Date Wed, 07 Jan 2004 12:24:34 GMT
> From: Stefan Bodewig [] 
> On Tue, 30 Dec 2003, Jose Alberto Fernandez 
> <> wrote:
> > That does not seem to work in 1.6.0 since <style/> only uses the 
> > classpath to find the the Liason but the TRAX liason does 
> not uses it 
> > to find the factories.
> I don't think this has changed in 1.6 at all.

Were we using JAXPUtils in 1.5.x? What it seem to me is that the
API for JAXPUtils is wrong since it does not take into account
tasks passing a ClassLoader.

For <style/> is even worst because it does not even uses JAXPUtils
(although <xmlvalidate/> does) and <ejb/> expects a validating
parser, if that is not what is found in CLASSPATH it breaks.

> > The main issue here seem to be that non of our tasks set the 
> > ContextClassLoader before calling the methods on the xml-apis.
> I agree that they should set the context classloader.
JAXPUtils methods should expect a ClassLoader. I would like to
just change the API instead of adding more methods, but I am
not sure if this API is considered to be public already.
Having the calls without ClassLoader just instigate writing bad tasks.

> > Am I doing something wrong? I think we have a backward 
> compatibility 
> > issue here.
> Only if it actually worked in 1.5.x 8-)  And I'd like to 
> understand why it works for you there before changing 1.6.

My build worked in 1.5.x, but the transmutation into 1.6.0
was not easy, here is the long story:

In 1.5.x I had saxon.jar (which includes a non validating parser)
in my project libraries and not in ANT. I used the <classpath/>
to make it available to <style/>. In 1.6.0 I was unable to make
that configuration work (not sure why). So I had to move
saxon.jar to ant/lib and not we have the conflict of the parsers.

Notice this only happens when running JDK 1.3 since in 1.4 crimson
is part of the runtime so it takes precedence. Which means this 
problem gets dormant depending on the VM being used.

The only way I could solve the problem was by specifying
"-lib ant/lib/xercerImpl.jar" in the command line, which moved
the correct parser to the beginning of the CLASSPATH. 

In general, I think all ANT maintained tasks should be more 
ClassLoader aware than they are right now. Have a similar problem
with the <script[def]/> tasks which do not make use of the calls in
BSF to set the classloader (which are there). They all
should accept at least a classpathref attribute.
Had a script needing Oracle's JDBC driver and that was another nightmare
to make it work correctly. (But I pay that in 1.5 :-) ).

Jose Alberto

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message