XML在Firefox中格式不正确,无法从服务器获取xml响应 [英] XML Not well formed in Firefox getting xml response from server
问题描述
我在项目中使用的是jQGrid最新版本.以下是我配置的完整配置.
I am using jQGrid Latest version in my project.following is complete configuration that i configured.
jQuery("#list").jqGrid( {
url : 'Link.do?method=findAllBrand',
mtype : 'GET',
height : 350,
datatype : "xml",
colNames : [ 'Name' ],
colModel : [ {
name : 'name',
index : 'name',
width : 620
} ],
rowNum : 10,
rowList : [ 10, 20, 30 ],
sortname : 'id',
sortorder : "desc",
viewrecords : true,
multiselect : true,
imgpath : 'themes/base/images',
caption : "Brand (s) Summary Grid",
pager : $('#pager'),
cache : false,
onSelectRow : function(id) {
}
});
我正在从服务器获取xml形式的以下数据:
I am getting following data in form of xml from server :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><rows><page>1</page><total>1</total><records>4</records><row id="BRD00003"><cell>Blanco</cell></row><row id="BRD00001"><cell>Bosch</cell></row><row id="BRD00004"><cell>Chef</cell></row><row id="BRD00002"><cell>F&P</cell></row></rows>
我知道在最后一行的最后一个单元中正在创建问题,因为它包含& char在xml中具有特殊含义.但是我使用下面的函数使用Apache commons lang库对整个xml进行了转义.
i know that in the last cell of last row is creating problem , because it contains & char which has special meaning in the xml. however i have escaped sequence the whole xml using Apache commons lang library using below function.
toXml = StringEscapeUtils.escapeXml(toXml);
,结果字符串为
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><rows><page>1</page><total>1</total><records>4</records><row id="BRD00003"><cell>Blanco</cell></row><row id="BRD00001"><cell>Bosch</cell></row><row id="BRD00004"><cell>Chef</cell></row><row id="BRD00002"><cell>F&P</cell></row></rows>
在Mozilla firefox最新版本和chrome中,我仍然遇到相同的错误,即7,8.
still i got the same error in Mozilla firefox latest version and in chrome , ie 7,8 also.
我必须向您展示这个特殊字符,以便如何解决此问题?
谢谢 米希尔·帕雷克(Mihir Parekh)
Thank You Mihir Parekh
推荐答案
我正在从服务器端生成xml.
i am generating the xml from server side.
然后分别转义每个文本节点和每个属性值,就这么简单.
Then escape each text node and each attribute value separately, it's all simple as that.
这篇关于XML在Firefox中格式不正确,无法从服务器获取xml响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!