Conflict between Spring and XOM

In my Java program, I made a class that uses XOM to read XML files. I am also using Spring. When the line: ApplicationContext ctx = new ClassPathXmlApplicationContext("dataIO-beans.xml"); is executed, I get an exception that includes: javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [org.apache.xerces.jaxp.DocumentBuilderFactoryImpl@4d48f152] does not support XML Schema. Are you running on Java 1.4 with Apache Crimson? Upgrade to Apache Xerces (or Java 1.5) for full XSD support. javax.xml.parsers.ParserConfigurationException: Unable to validate using XSD: Your JAXP provider [org.apache.xerces.jaxp.DocumentBuilderFactoryImpl@4d48f152] does not support XML Schema. Are you running on Java 1.4 with Apache Crimson? Upgrade to Apache Xerces (or Java 1.5) for full XSD support. If I remove dtd-xercesImpl.jar from the Eclipse project build path, Spring successfully reads the bean from the xml file, but now my XML reading class doesn't work because XOM needs that jar file. How can I correct this?


Looks like I found a solution. I downloaded the Xerces2 binaries from http://xerces.apache.org/mirrors.cgi and added those JARs to the build path instead of using the dtd-xercesImpl.jar and it worked.

链接地址: http://www.djcxy.com/p/34900.html

上一篇: 使用Stax进行DTD分析

下一篇: Spring与XOM之间的冲突