Menu

Using saxon9-dom.jar? Is it really necessary?

Help
Anonymous
2011-03-02
2012-10-08
  • Anonymous

    Anonymous - 2011-03-02

    Hello,

    during my current project I faced an issue concerning XmlUnit (a lib for xml
    assertions). When I want to compare two xml strings. By calling this code:

    XMLUnit.setIgnoreWhitespace(true);
    XMLUnit.setNormalizeWhitespace(true);
    XMLAssert.assertXMLEqual(expectedResultXMLString, actualResultXML);

    I got an exception "java.lang.IllegalArgumentException: When a DOMSource is
    used, saxon9-dom.jar must be on the classpath" from the saxon lib I included.

    I'm using maven, so the dependency for the saxon lib is. First question at
    this point. Am I using the right one?
    <dependency>
    <groupId>net.sourceforge.saxon</groupId>
    <artifactId>saxon</artifactId>
    <version>9.1.0.8</version>
    <scope>provided</scope>
    </dependency>

    After a little internet research I've found some posts saying that the
    saxon9-dom.jar was included into the saxon lib I'm currently using. Is that
    true?
    In order to continue with my implementation I decided to include the
    saxon9-dom into my classpath, but I could not found any maven dependency. Is
    there really no dependency available?

    Finally I found the jar and everything works fine.

    Now, I would like to know if that is the right way to deal with that issue. Is
    the saxon9-dom.jar really an extension to the normal saxon lib or did I miss
    something? Do I have to deploy the saxon9-dom.jar as third party lib into my
    local maven repo?

    Thank you very much for your help.

    Greetings

    Gerardo

     
  • Michael Kay

    Michael Kay - 2011-03-02

    Firstly, there is no maven hosting of Saxon that is supported by Saxonica.
    Individuals have posted some Saxon releases to Maven repositories in the past,
    usually with no respect for the licensing conditions which require that you
    can't distribute a JAR file without the accompanying legal notices, and often
    with no detailed attention paid to the cross-jar dependencies.

    The latest release is 9.3.0.4. You might of course still have valid reasons
    for using Saxon 9.1.0.8, for example if your application depends on it. In 9.3
    (and 9.2, I think) the extra saxon9dom.jar is not needed (the code was
    integrated into the main JAR file). But if you're using the 9.1 branch, then
    you need the separate JAR file. Please download from SourceForge, not from
    third-party sites.

     
  • Anonymous

    Anonymous - 2011-03-02

    Great. Thanks for the fast reply.

    Thanks for the advices. It helped a lot.

    I'm fascinated to seeing that you reply on almost every post within some
    hours. Good job.

    Ciao,

    Gerardo