error on line 1 at column 6: XML declaration allowed only at the start of the document
This page contains the following errors:
Below is a rendering of the page up to the first error.
--------------------------------------------------------------------------------------------------
今天调试接口的时候又发现了这个东西,在Google上找来几篇stackoverflow的帖子,总算是解决了。一般出现这种情况的时候
首先应该注意的是在“Header('Content-type: text/xml');”前不要有其他输出,最好将“Header('Content-type: text/xml');”放在文件的最顶端;
然后检查一下是不是真的像它说的那样在输出的第一行有空行;
最后就是检查你的编码是不是BOM格式的,如果是的话,改成无BOM格式的试试。
什么是BOM,其实我也不太明白,所以就百度了一下:
UTF-8 BOM又叫UTF-8 签名,其实UTF-8 的BOM对UFT-8没有作用,是为了支援UTF-16,UTF-32才加上的BOM,BOM签名的意思就是告诉编辑器当前文件采用何种编码,方便编辑器识别,
但是BOM虽然在编辑器中不显示,但是会产生输出,就像多了一个空行。
我的问题就在于不应该是用BOM格式的,改一下,问题就解决了。
error on line 1 at column 6: XML declaration allowed only at the start of the document的更多相关文章
- Sitemap Error : XML declaration allowed only at the start of the document解决方法
今天ytkah的客户反馈说他的xml网站地图有问题,提示Sitemap Error : XML declaration allowed only at the start of the documen ...
- SVG报错error on line 39 at column 26: Namespace prefix xlink for href on script is not defined
转自:http://stackoverflow.com/questions/3561270/error-on-line-39-at-column-26-namespace-prefix-xlink-f ...
- Parse Fatal Error at line 41 column 24: 元素类型 "url-pattern" 必须由匹配的结束标记 "</url-pattern>" 终止
1.错误描述 严重: Parse Fatal Error at line 41 column 24: 元素类型 "url-pattern" 必须由匹配的结束标记 "< ...
- 关于xml加载提示: Error on line 1 of document : 前言中不允许有内容
我是在java中做的相关测试, 首先粘贴下报错: 读取xml配置文件:xmls\property.xml org.dom4j.DocumentException: Error on line 1 of ...
- Java使用dom4j读取xml时报错:org.dom4j.DocumentException: Error on line 2 of document : Invalid byte 2 of 2-byte UTF-8 sequence. Nested exception: Invalid byte 2 of 2-byte UTF-8 sequence
1.Java使用dom4j读取xml时报错: org.dom4j.DocumentException: Error on line 2 of document : Invalid byte 2 of ...
- Jmeter BeanShell 引用变量报错jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval Parse error at line 14, column 181 : Error or number too big for integer
如果你通过CSV Data Set Config或者_StringFromFile函数来参数化你的请求,需要特别注意当参数为纯数字时,jmeter会默认将其识别成int型数据,说明jmeter并不是默 ...
- MongoDB_"Error parsing YAML config file: yaml-cpp: error at line 3, column 9: illegal map value"解决方法
在启动配置文件的时候,系统报错:Error parsing YAML config file: yaml-cpp: error at line 3, column 9: illegal map val ...
- idea报错。Error:Failed to load project configuration: cannot parse xml file E:\project\.idea\workspace.xml: Error on line 1: 前言中不允许有内容。
因为电脑卡死强制重启电脑后打开idea,进行junit单元测试报错: idea报错.Error:Failed to load project configuration: cannot parse x ...
- XML Parser Errors See Details for more Information XML Parser Error on line 1: Document root ele
1.错误描写叙述 XML Parser Errors See Details for more Information XML Parser Error on line 1: Document roo ...
随机推荐
- C# .NET开发Oracle数据库应用程序
.NET Framework访问Oracle数据库至少有两种方式,一种是利用微软提供的ADO.NET,另一种是利用Oracle提供的ODP.NET. 安装VS的时候会附带ADO.NET,安装Oracl ...
- Java 8 表示两个时间点距离
Java JDK8 的 java.time API 提供全面的 date 和 time 的模型. 下面是一个使用案例:求两个时间点的距离. package com.tony.test; import ...
- Java与.net的区别delegate和event
There is no delegate concept in Java The right-side C# program may be mimiced with reflection techno ...
- 简单的jQuery日期选择
建立一个存放日期的文本框 点击文本框弹出一个选择框引用jQuery文件引用bootstrap文件 使用模态框 使用模态框的方法设置点击文本框显示模态框手动打开模态框的方法:$('id').modal( ...
- android改动tab 导航 指示器颜色
我事实上想改动的上面的蓝色条条,改成红色. 这个问题实在是困扰我了太长时间.之前參照google的这个文章: https://developer.android.com/training/basics ...
- [Protractor] Test Simple Binding With Protractor
Protractor is built to interact with AngularJS applications. In this lesson, we will take a look at ...
- nginx中时间的管理
nginx出于性能考虑採用类似lib_event的方式,自己对时间进行了cache,用来降低对gettimeofday()的调用,由于一般来说server对时间的精度要求不是特别的高,只是假设须要比較 ...
- Chrome调试大全--转载
作为一名前端开发者,打交道最多的可能是和浏览器.市面上各种浏览器多不胜数,主流的有Chrome,Firefox,Safari,IE,Opera,非主流的如360,遨游,QQ浏览器,搜狗浏览器,据说淘宝 ...
- table标签
table标签使我们最常用的的标签,在使用table标签时我们要注意一些其属性,早期我们经常使用table标签对其进行页面布局但是现在我们基本不再使用,由此可见table标签也是非常强大的一个工具. ...
- 秒味课堂Angular js笔记------过滤器
不同过滤器的小demo. currency number uppercase json limitTo date orderBy filter <script> var filterMy ...