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 ...
随机推荐
- 值得收藏的Javascript代码
1 Javascript数组转换为CSV格式 首先考虑如下的应用场景,有一个Javscript的字符型(或者数值型)数组,现在需要转换为以逗号分割的CSV格式文件.则我们可以使用如下的小技巧,代码如 ...
- Merge Two Sorted Lists—LeetCode
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing t ...
- otl获得sql出错位置(oracle)
项目的一个需要,要获得sql出错的位置,从而给出类似sqlplus的错误提示(如下) sql出错原因易获得,记录在otl_exception::msg,但出错位置就不是那么容易了. 默认情况下otl异 ...
- Git详解之二 Git基础
Git 基础 读完本章你就能上手使用 Git 了.本章将介绍几个最基本的,也是最常用的 Git 命令,以后绝大多数时间里用到的也就是这几个命令.读完本章,你就能初始化一个新的代码仓库,做一些适当配置: ...
- (转)Maven实战(三)Eclipse构建Maven项目
1. 安装m2eclipse插件 要用Eclipse构建Maven项目,我们需要先安装meeclipse插件 点击eclipse菜单栏Help->Eclipse Marketplac ...
- Vagrant 部署python开发环境
Vagrant简介 Vagrant是一个基于Ruby的工具,用于创建和部署虚拟化开发环境.它使用Oracle的开源VirtualBox虚拟化系统,使用 Chef创建自动化虚拟环境. 在Windows下 ...
- Android自定义属性、控件三步法
第二步中layout-activity_main.xml 中自命名控件: xmlns:android="http://schemas.android.com/apk/res/android& ...
- img的onerror事件
使用场景 其实on error使用上是比较简单的. 当我们网站上出现了无效图片,而我们希望用友好的方式告诉用户,而不是显示红叉叉. w3c上解释的 定义和用法: onerror 事件会在文档或图像加载 ...
- UVA 12378 Ball Blasting Game 【Manacher回文串】
Ball Blasting Game Morteza is playing a ball blasting game. In this game there is a chain of differe ...
- 黑信 socket即时通讯 示例
整个过程 首先开启服务器 打开一个SDK大于4.4的手机---B 打开一个SDK小于4.4的手机---A 相互发送一条消息,对方就可以收到,当然这些消息都是通过服务器[转发]过来的 MainActiv ...