org.dom4j.DocumentException: c Nested exception: c

使用dom4j解析XML的时候抛出异常,是因为xml文件中有错误,有不能识别的标签或者格式。

在网上有人说是缺少jaxen-1.1-beta-6.jar包,不过我编译的时候没有这个jar包也好使,不知道为什么。

org.dom4j.DocumentException: c Nested exception: c
    at org.dom4j.io.SAXReader.read(SAXReader.java:321)
    at org.dom4j.io.SAXReader.read(SAXReader.java:201)
    at org.dom4j.io.SAXReader.read(SAXReader.java:190)
    at TestForStudy.ParseXMLDom4j.updateXML(ParseXMLDom4j.java:81)
    at TestForStudy.ParseXMLDom4j.main(ParseXMLDom4j.java:26)
Nested exception:
java.net.UnknownHostException: c
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
    at java.net.Socket.connect(Socket.java:524)
    at java.net.Socket.connect(Socket.java:474)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
    at sun.net.NetworkClient.openServer(NetworkClient.java:118)
    at sun.net.ftp.FtpClient.openServer(FtpClient.java:488)
    at sun.net.ftp.FtpClient.openServer(FtpClient.java:475)
    at sun.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:270)
    at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:352)
    at java.net.URL.openStream(URL.java:1007)
    at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
    at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
    at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source)
    at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.dom4j.io.SAXReader.read(SAXReader.java:302)
    at org.dom4j.io.SAXReader.read(SAXReader.java:201)
    at org.dom4j.io.SAXReader.read(SAXReader.java:190)
    at TestForStudy.ParseXMLDom4j.updateXML(ParseXMLDom4j.java:81)
    at TestForStudy.ParseXMLDom4j.main(ParseXMLDom4j.java:26)
Nested exception: java.net.UnknownHostException: c
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
    at java.net.Socket.connect(Socket.java:524)
    at java.net.Socket.connect(Socket.java:474)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
    at sun.net.NetworkClient.openServer(NetworkClient.java:118)
    at sun.net.ftp.FtpClient.openServer(FtpClient.java:488)
    at sun.net.ftp.FtpClient.openServer(FtpClient.java:475)
    at sun.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:270)
    at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:352)
    at java.net.URL.openStream(URL.java:1007)
    at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
    at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
    at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source)
    at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.dom4j.io.SAXReader.read(SAXReader.java:302)
    at org.dom4j.io.SAXReader.read(SAXReader.java:201)
    at org.dom4j.io.SAXReader.read(SAXReader.java:190)
    at TestForStudy.ParseXMLDom4j.updateXML(ParseXMLDom4j.java:81)
    at TestForStudy.ParseXMLDom4j.main(ParseXMLDom4j.java:26)

你可能感兴趣的:(exception)