DOM技术对xml增删改查后更新源文件异常报错

Exception in thread "Thread-13" java.lang.AbstractMethodError: org.apache.crimson.tree.XmlDocument.getXmlStandalone()Z
 at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.setDocumentInfo(DOM2TO.java:373)
 at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:127)
 at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:94)
 at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:662)
 at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:708)
 at com.sun.org.apache.xa
 lan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:313)
 at com.emdeon.PAM.procedure.PamAddressVerifier.docToString(PamAddressVerifier.java:403)
 at com.emdeon.PAM.procedure.PamAddressVerifier.toXML(PamAddressVerifier.java:348)
 at com.emdeon.PAM.procedure.PamAddressVerifier.verify(PamAddressVerifier.java:142)
 at com.emdeon.PAM.controller.AddressVerificationPopupController.submit(AddressVerificationPopupController.java:1350)
 at com.emdeon.PAM.controller.AddressVerificationPopupController$1.start(AddressVerificationPopupController.java:1277)
 at com.emdeon.PAM.ext.WorkThre

 

<?xml version="1.0"encoding="UTF-8"standalone="no"?>
<cars>
    <car id="1">
        <name>bus</name>
        <effect>城市公共交通工具</effect>
        <weight>3</weight>
        <fixed>40</fixed>
    </car>
    <car id="2">
        <name>tractor</name>
        <effect>农业运载工具</effect>
        <weight>2</weight>
        <fixed>2</fixed>
    </car>
</cars>

 现有如上XML文档,请使用DOMid1的汽车添加长度元素(length),同时修改fixed元素的值为30,并将id2的汽车fixed元素删除。

以上代码中,需要导入jar包:xerces-2.6.2.jar,由于之前导入的是xerces-2.3.0.jar包,遇到java.lang.AbstractMethodError: org.apache.crimson.tree.XmlDocument.getXmlStandalone()Z报错,换成xerces-2.6.2.jar就可以了!

原先还有导入crimson.jar包,但也是报这个错误,后来查到是sun把crimson.jar给废了,可是又没有错误提示。把crimson.jar删除了,xml就可以正常生成了。

Exception in thread"main"java.lang.AbstractMethodError: org.apache.crimson.tree.XmlDocument.getXmlStandalone()Z
    at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.setDocumentInfo(DOM2TO.java:373)
    at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:127)
    at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:94)
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:662)
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:708)
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:313)

 在控制台和源文件car.xml输出如下:

 

 

原文地址:http://www.cnblogs.com/yiscat/archive/2013/04/23/3037445.html


 

阅读更多
个人分类: Java异常处理
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭