日期:2014-05-16  浏览次数:20367 次

ExtJS 报错Uncaught Ext.DomQuery.compile(): Error parsing selector. Parsing failed
我解析soap xml的时候,引用官方的reader,但是发现解析的时候报错Uncaught Ext.DomQuery.compile(): Error parsing selector. Parsing failed at "|Body" ,代码如下:
Reader.js:
Ext.define('Ext.data.soap.Reader', {
    extend: 'Ext.data.reader.Xml',
    alias: 'reader.soap',

    getData: function(data) {
        var envelope = data.documentElement,
            // we can't always assume that the Body element's namespace prefix is "soap",
            // but we can assume that it is the same as the envelope's namespace prefix
            prefix = envelope.prefix;

        return Ext.DomQuery.selectNode(prefix +'|Body', data);
    }
});

我的xml文件跟官网的例子中的非常相似,结构基本一致,但是不知道为什么就是解析不出数据,xml文件如下
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<fjs1:GetDepartmentDataResponse xmlns:fjs1="http://www.digiwin.com.cn/tiptop/TIPTOPServiceGateWay">
<fjs1:response>
<fjs1:element>
<fjs1:gem01>00010</fjs1:gem01>
<fjs1:gem02>大陆10</fjs1:gem02>
<fjs1:gemacti>Y</fjs1:gemacti>
</fjs1:element>
<fjs1:element>
<fjs1:gem01>00011</fjs1:gem01>
<fjs1:gem02>大陆11</fjs1:gem02>
<fjs1:gemacti>Y</fjs1:gemacti>
</fjs1:element>
<fjs1:element>
<fjs1:gem01>00012</fjs1:gem01>
<fjs1:gem02>大陸12</fjs1:gem02>
<fjs1:gemacti>Y</fjs1:gemacti>
</fjs1:element>
<fjs1:element>
<fjs1:gem01>001</fjs1:gem01>
<fjs1:gem02>管理部</fjs1:gem02>
<fjs1:gemacti>N</fjs1:gemacti>
</fjs1:element>
<fjs1:element xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"></fjs1:element>
</fjs1:response>
</fjs1:GetDepartmentDataResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

官网例子的xml如下
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <m:GetBlendersResponse xmlns:m="http://example.com/">
            <m:Blender>
                <m:id>1</m:id>
                <m:name>Total Blender Classic WildSide</m:name>
                <m:price>454.95</m:price>
            </m:Blender>
            <m:Blender>