org.xml.sax.SAXParseException: Premature end of file

前端之家收集整理的这篇文章主要介绍了org.xml.sax.SAXParseException: Premature end of file前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。


org.xml.sax.SAXParseException: Premature end of file.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1427)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1056)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)

at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)



测试一下struts+hibernate 框架是否搭建成功,导入jar包,配置web.xml,建struts.xml,hibernate,cfg.xml 文档之后,运行项目,报此bug。

------struts.xml 文档是声明了,其他没有任何内容。于是加上标签 <struts></struts>之后就ok啦。

------hibernate.cfg.xml 文档只是声明了,没有写其他任何标签,是ok的。

调皮的试了一下

在struts 文档中加上 <dxm></dxm>,猜想一定报错,因为不是struts的标签

Document root element "dxm",must match DOCTYPE root "struts". at (null:10:10) org.xml.sax.SAXParseException: Document root element "dxm",must match DOCTYPE root "struts". at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)

原文链接:https://www.f2er.com/xml/297000.html

猜你在找的XML相关文章