Hi I am having problem with Xerces and Xalan
Originally I wrote a program which uses XML DOM to parse an XML file, this worked fine and I was using the public org.w3c.dom classes without any problems, it worked ok on JRE 1.5 and JRE 1.4.2 which both need to be supported.
Later on I wanted to use XPath which is only a standard library in JRE 1.5, so instead I used the XPath API included as part of the Xalan 2 distribution, and added Xalan 2 (Xalan 2.5.2) to my classpath and things worked ok. ( Originally I added all the jars which came with the Xalan 2 distribution including xercesImpl.jar and xml-apis.jar but this caused me to get the error
java.lang.NoClassDefFoundError: org/w3c/dom/ranges/DocumentRange
.......
at org.apache.xerces.jaxp.DocumentBuilderImpl.<init>(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(Unknown Source)
on 1.4.2 so I removed them.
Now I am using a third party library for another stage of the project and this requires
xercesImpl.jar and xml-apis.jar as part of its distribution. If I don't include them when I get to using this functionality it throws
java.lang.NoClassDefFoundError: org/apache/xerces/parsers/SAXParser
for botth 1.4.2 and 1.5 so it appears to be using Xerces directly. If I put them back in then I get the error I had before for 1.4.2
Unfortunately I am not in a position to change the third party code but I could change mine. I dont really understand why adding these libraries causes my original code to fail because I thought they would be added to the classpath after the rt.jar and under 1.4.2 the org/w3c/dom/ranges/DocumentRange package exists (in 1.5 it has moved and been renamed so there is no conflict).
I have no particular desire to use Xerces/Xalan I just want to use a parser that adheres to the java Apis , but with XPath support.
Any solutions much appreciated, but i want to deploy this application to end users so any os/java version specific fixes would not be much use.
Thanks Paul