xml中包含如下
<!-- 责任代码 -->
<itemCode>0007</itemCode>
<!-- 责任名称 -->
<itemName>火车(含地铁、轻轨)</itemName>在window下无异常
在linux下出现
Digester.java:1765:ERROR] Parse Fatal Error at line -1 column -1: Premature end of file.
org.xml.sax.SAXParseException: Premature end of file.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1911)
我吧中文全部删除替换成数字和英文,就未出现异常了,请问如何解决

解决方案 »

  1.   

    可能是你的路径有问题
    windows与linux的文件系统的那个路径分隔符是反的
    "\device\aaa"windows下边这么写到linux下就得改成"/device/aaa"
      

  2.   

    看看解析xml有没有设置字符集的参数的方法,跟进去看看是什么流读的
      

  3.   

    Digester.java:1765:ERROR] Parse Fatal Error at line -1 column -1: Premature end of file.从这里看,是你的xml不规范引起的。
    你得看看你的xml文件配置对不对。