读取XML文件报 - Content is not allowed in prolog
来源:互联网 发布:淘宝人工电话是多少 编辑:程序博客网 时间:2024/05/01 03:55
xml 文件使用某些编辑器编辑之后, 使用DOM4j读取时报Content is not allowed in prolog的错误。
关于BOM的说明如下。
在UCS 编码中有一个叫做"ZERO WIDTH NO-BREAK SPACE"的字符,它的编码是FEFF。而FFFE在UCS中是不存在的字符,所以不应该出现在实际传输中。UCS规范建议我们在传输字节流前,先传输字符"ZERO WIDTH NO-BREAK SPACE"。这样如果接收者收到FEFF,就表明这个字节流是Big-Endian的;如果收到FFFE,就表明这个字节流是Little-Endian的。因此字符"ZERO WIDTH NO-BREAK SPACE"又被称作BOM。
UTF-8不需要BOM来表明字节顺序,但可以用BOM来表明编码方式。字符"ZERO WIDTH NO-BREAK SPACE"的UTF-8编码是EF BB BF。所以如果接收者收到以EF BB BF开头的字节流,就知道这是UTF-8编码了。
Windows就是使用BOM来标记文本文件的编码方式的。
解决方法当然是删除BOM的表头
参见
http://blog.csdn.net/oscar999/article/category/801452
- 读取XML文件报 - Content is not allowed in prolog
- org.xml.sax.SAXParseException: Content is not allowed in prolog.
- Xml解析Exception:Content is not allowed in prolog
- Xml解析Exception:Content is not allowed in prolog
- org.xml.sax.SAXParseException: Content is not allowed in prolog
- org.xml.sax.SAXParseException: Content is not allowed in prolog
- org.xml.sax.SAXParseException: Content is not allowed in prolog.
- SAX解析xml:SAXParseException: Content is not allowed in prolog
- org.xml.sax.SAXParseException: Content is not allowed in prolog.
- xml解析Content is not allowed in prolog
- properties、xml content is not allowed in prolog
- org.xml.sax.SAXParseException: Content is not allowed in prolog.
- ibatis的sqlmap.xml 报错:Content is not allowed in prolog异常的原因
- DOM解析XML报错:Content is not allowed in prolog
- 2017-04-30 每日一记 解析XML文件:Content is not allowed in prolog.
- Content is not allowed in prolog
- Content is not allowed in prolog.解决方法
- DOM4j:Content is not allowed in prolog
- Top100研发管理与工程实践案例征集
- 复杂的个人信息登录界面
- Android ApiDemos示例解析(185):Views->Progress Bar->4. In Title Bar
- 11个高效的VS调试技巧
- 计算器
- 读取XML文件报 - Content is not allowed in prolog
- 制作n*n的乘法表
- 准备软考,做题第一周
- 使用Mulitview制作选项卡效果
- 制作链接数据库并互相跳转的登录与注册
- 黑马程序员_JavaSE基础20 之 其它对象API IO流 FileReader FileWriter合
- Windows7 IIS的安装与配置<图解>
- GLSurfaceView使用之第二篇画三角形
- 数据库查询的例子及SQL语句