java读取xml文件报“org.xml.sax.SAXParseException: Premature end of file
来源:互联网 发布:icloud照片下载到mac 编辑:程序博客网 时间:2024/05/01 23:59
背景:java读取xml文件,xml文件内容只有“<?xml version="1.0" encoding="UTF-8"?>”一行
java读取该xml文件时,报“org.xml.sax.SAXParseException: Premature end of file”错误。
java解析xml文件时抛出异常:
org.xml.sax.SAXParseException: Premature end of file.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:264)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:98)
at com.eos.system.utility.XmlUtil.parseFileThrowsException(XmlUtil.java:1788)
解决方案:发现xml文件中只有<?xml version="1.0" encoding="UTF-8"?>一句,没有内容,随便添加一个空的标签后,异常就没有了
文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<xml-body>
</xml-body>
0 0
- java读取xml文件报“org.xml.sax.SAXParseException: Premature end of file”
- java读取xml文件报“org.xml.sax.SAXParseException: Premature end of file
- org.xml.sax.SAXParseException: Premature end of file
- org.xml.sax.SAXParseException: Premature end of file
- 关于启动报错org.xml.sax.SAXParseException: Premature end of file
- faultString: org.xml.sax.SAXParseException: Premature end of file问题解决方案
- SAXParseException : Premature end of file
- Android org.xml.sax.SAXParseException: Unexpected end of document
- [java]org.xml.sax.SAXParseException
- dom4j中使用SAXReader读取xml文件出现Premature end of file异常问题
- xml中的Premature end of file
- 解决SAXParseException: Premature end of file
- zul页面报org.xml.sax.SAXParseException
- org.xml.sax.SAXParseException
- org.xml.sax.SAXParseException
- org.xml.sax.SAXParseException
- Android解决异常org.xml.sax.SAXParseException: Unexpected end of document
- spring xml配置文件中指定的xsd文件读取不到了org.xml.sax.SAXParseException:
- [Random Coding] De/Serialization Binary Tree
- [Random Coding] De/Serialization of Binary Search Tree
- [Leetcode] - Max Points on a Line
- 《黑马程序员》 高新技术第二天学习之枚举的入门和枚举的构造函数的调用
- 【静静的花开】有感:杂谈春天来
- java读取xml文件报“org.xml.sax.SAXParseException: Premature end of file
- webbrowser获取动态网页元素
- 路由器DHCP的配置详细方法
- cordova介绍
- 面试题整理12 求字符串括号最大深度子串
- 如何在《微软技术社---新闻组,论坛,BBS》上访问自己参与过的话题?
- linux从开机加电到执行main函数之前
- OSGi,Java模块化框架的另类进化
- 验证码客户端验证