当我用s1 EPSDK36 run xsd文件时,从一个已经做好的xsd文件copy template写自己的文件时,总是报出:Content is not allowed in prolog 错误。
尝试半天结果一样,用文件对比工具问题还是得不到解决;
查询得知是BOM的问题,把文件转存为UTF-8 no BOM 格式,一切ok。
现做简单总结;
*********************************************************************
参考文档:
Content is not allowed in prolog
疯了,可怜的Java 可怜的JSP,问题真多:Content is not allowed in prolog.
一个简单的JSP,转换一个XML输出HTML
<c:import url="Test.xsl" var="stylesheet"/>
<x:transform xslt="${stylesheet}" doc="Test.xml"/>
报错:Content is not allowed in prolog.
上网查,说可能是BOM问题,说很多编辑器保存UTF-8时会在前面加个0xFE之类的,
但是很多XML解析器又不认识。。。。
是这个原因吗?我更改了其他编码,也曾经用编辑器把0xFE去掉,没用啊。。。
其他回答:
对于UTF-8编码的文件来说, BOM头是可有可无的. 如果用dom4J加载含有BOM
头的UTF-8格式的xml文件, 却会抛出"Content is not allowed in prolog"异常.
原来无BOM头的UTF-8文件在经过UltraEdit编辑后, UltraEdit会擅自作主添加一个
BOM头(EditPlus无此问题, 记事本似乎有此问题), 即使去掉UltraEdit中与BOM相
关的所有设置选项也无济于事. 后来在UltraEdit论坛搜索答案, 有人提到11版以后
(含)的UltraEdit"另存为"对话框提供了另存为"UTF-8 - NO BOM"的一个选项.对理
想主义者来说, 这不能算是一个很完美的解决方法:(
进一步研究可以发现, IE/Windows记事本/XmlBuddy等等可正常显示含BOM头的
UTF-8格式文件.那么完美方案应该是让dom4j能正确读入含BOM头的UTF-8文件.
在dom4j的sourceforge论坛上已经有人就此提问, 但是答案中的链接已经失效. 再
次google, 在这里找到了一段代码.
/////////////////////////////
在 windows 上,檔案如果是存檔成 unicdoe 或是 utf-8 的時候,如果用 ultraedit 或是其他可以用二進元觀看檔案的軟體打開檔案,會看到檔案的開頭多了 FE FF 這 2 個位元組的東西,去年自己在玩 hibernate 時候,使用 xml 檔案做為 hibernate 初始化的設定檔,那時候曾出現一個怪問題,就是在讀取 xml 檔案的時候,xml parser 一直回報 Content is not allowed in prolog 的錯誤訊息,上網查了查資料後,才發現原來是因為檔案的前面有unicdoe 的 BOM 識別字元。
22222222222222222:
http://www.blogjava.net/bigseal/archive/2005/02/27/1535.aspx
"Content is not allowed in prolog" error
Posted on 2005-02-27 11:09 bigseal 阅读(6046) 评论(3) 编辑 收藏
看到一篇关于在eclipse中使用ant构建java项目的文章,就按照文章中的说明新建了一个项目,并新建了classes,dist,doc,lib几个文件夹和build.xml文件。其中build.xml文件的内容也是直接复制的,由于是从网页上直接复制的,里面“<”“>”都是中文格式的,我就把这些给替换了一下。
但当选中项目,然后选择“Project”,“Properties”,“Builders”,“New…”,选择“Ant Build”:载入“Bulidfile”时提示“Content is not allowed in prolog”错误。
我就去Google上转了一圈,还有点收获,看了一篇小文章,觉得可能是build.xml文件格式的错误。
In SGML and XML, a document is composed of two sequential parts,
the prolog and the instance. You can see this in an HTML example:
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN "
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " >
3 <html xmlns= "http://www.w3.org/1999/xhtml " >
4 <head >
5 <title >The Symbol Grounding Problem </title >
6 </head >
7 <body >
8 </body >
9 </html >
In this example, the prolog is lines 1-2, the instance begins on
line 3. The prolog includes the DOCTYPE declaration, the external
subset (called the DTD), and the internal subset (which you seldom
see but it 's legal). The document instance includes the document
element (in this case <html > and all of its descendent content).
You generally don 't want to see the prolog, and you generally don 't
want to store it. The DOCTYPE declaration provides references to
DTD, which is instantiated as part of the process of validating the
document. You may want to store the reference(s), but you wouldn 't
want to store the DTD each time you store the document, as that
would be a real waste (the DTD is often bigger than the document).
It sounds like your well-formed and valid document isn 't being
considered as such by the XML processor. The error message indicates
that there is content (i.e., either elements or character data) in
the part of the document considered as the prolog. You may be missing
the last " > " on line 2 above, as that would normally be the beginning
of the internal subset. If it found " <html " (or something similar),
you might get that error.
果然,有两个“!”是中文状态,改过来就ok 了。
- 大小: 63.2 KB
分享到:
相关推荐
NULL 博文链接:https://rayoo.iteye.com/blog/1973032
opencv-2.4.9/modules/gpu/src/nvidia/core/NCVPixelOperations.hpp(51): error: a storage class is not allowed in an explicit specialization 这是由于NCVPixelOperations.hpp的问题,只要替换opencv-2.4.9/...
keil 编译时出现错误和警告总结 中国电子DIY之家
设置隐试打开PPT报错 Hiding the application window is not allowed
keil常见错误 keil常见错误 keil常见错误 keil常见错误
Error:(25, 5) Integer types not allowed (at 'android:textSize' with value '12'). 代码 <style name=HorizontalBtnLayout> <item name=android:layout_height>match_parent <item name=android:...
Android WebView 报 Not allowed to load local resource错误的解决办法 博客地址:http://blog.csdn.net/yuzhiqiang_1993/article/details/76228541
directories that will not be allowed to be processed by Diskeeper. Event Logging ------------- Diskeeper records information about its activity in two ways. First, general information about ...
本文实例讲述了ThinkPHP提示错误Fatal error: Allowed memory size的解决方法。...错误提示:Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 523800 bytes) in /var/w
常见错误: Error encoding arguments: Error: invalid bytes32 value (arg=””, coderType=...SyntaxError: Functions are not allowed to have the same name as the contract. If you intend this to be a const
Host 主机名 is not allowed to connect the mysql server 原因:没有授权远程访问mysql 解决方法: cmd 中运行mysql -u root -p(如果报mysql 不是内部或外部命令,找到安装mysql对应的bin文件夹运行mysql.exe,...
fatal:remote error: You can't push to git://github.com/username/*.git Use git@github.com:username/*.git 看来我是没有权限push啊。 解决方法: git remote rm origin git remote add origin git@github....
nginx: [emerg] “proxy_cache_path” directive is not allowed here in /etc/nginx/conf.d/default.conf:29 提示意思“proxy_cache_path指令不被允许”,在官网上查找了相关说明,也没有发现问题,最后看应用范围...
Android中有许多的xml定义文件,比如动画、图形等等。 刚接触android时,看见这些,通常时一头雾水,只有无尽的搜索... 这个文档,对这些xml中的属性进行了一定的整理。可以参考一下。
ERROR 1130 (HY000): Host ‘localhost’ is not allowed to connect to this MySQL server www.jb51.net 出现原因: mysql只有一个root用户,修改root密码后选了MD5,提交后,重新 登陆出现“Host ‘localhost’ is...
"Host 'localhost' is not allowed to connect to this MySQL server" 的原因及解决办法
主要介绍了php采用curl访问域名返回405 method not allowed提示的解决方法,需要的朋友可以参考下
从3GPP协议和UE端行为分析5G gmm cause #27的网络问题
本文实例讲述了php运行提示:Fatal error Allowed memory size内存不足的解决方法。分享给大家供大家参考。具体方法如下: 有些朋友新配置的环境或自己新写的程序运行时会碰到fatal error: Allowed memory size of ...