关于xml文件在浏览器报错的问题
最近在开发时为了方便写了一个非常简单的xml配置文件,内容如下: <?xml version="1.0" encoding="utf-8" ?> 后来出于需求又添加了一个属性:<versionName>1.0</versionName>。OK,问题来了,在浏览器中查看的时候一直报错。 在火狐中是: XML 解析错误:文档元素后丢弃的内容
在Google中是: This page contains the following errors:
error on line 3 at column 1: Extra content at the end of the document
Below is a rendering of the page up to the first error.我找了半天,最后才明白错误出在哪里。原来添加2个以上的元素后没有加入根元素,所以一直报错。修改后一切正常了。 正常的格式如下: <?xml version="1.0" encoding="utf-8" ?> <Document> <versionName>1.0</versionName> <versionCode>1.0</versionCode> </Document> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |