maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fenallen <>
Subject Different XML parsers in Maven 1.0.2 and Maven 1.1
Date Mon, 24 Oct 2005 11:16:01 GMT

This is not a question. Rather a tip for anyone struggling with xml in
Maven as I have recently.
Maven, ant, and the Sun jdk itself all handle the subject of different
xml parsers either poorly or not at all.
Here is a nice solution I have recently stumbled across.  I hope it is
proves of use to someone.

Download the mtxslt-1.5.jar jar file from here  and place it in your maven repository.
I use a group called 'shared' for jar files not found in the standard
ibiblio maven repository but you can put it wherever you like if you set
the dependency correctly.

The file is an extension to the standard ant xslt (or style) task which
allows the xml parser to be selected on the fly.

Add the dependency to you root project.xml file including the root
classloader property as here:


You will also need to do the same for any xml jar files you want to use:


Whilst it is possible to declare the classes in full each time, it is
easier to set these properties in the file thus:

#mtxslt helper properties

And finally declare the ant task in the root maven.xml file like this:

<taskdef name = "mtxslt" classname =

You should now be able to use saxon like this:
<mtxslt  processor="${mtxslt.saxon6}" in="infile.xml" out="outfile.xml"
style="stylesheet.xsl" />

If you want to use one of the other parsers you will also need to add
the relevant dependency as per the saxon example above.

This will then allow you to use a different parser only for this
specific task.  This means that Maven can continue to use its default
parser internally and you shouldn't have problems with plugins breaking

There are links to some good ant based examples on the mtxslt web page.

Hope it helps someone, Allen.

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

View raw message