Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Extjs XML读取器无法读取格式良好的XML_Extjs_Sencha Touch - Fatal编程技术网

Extjs XML读取器无法读取格式良好的XML

Extjs XML读取器无法读取格式良好的XML,extjs,sencha-touch,Extjs,Sencha Touch,但是,我有一个xml格式的数据源,每当我试图从中读取内容时,store reader就会抛出一个异常: “未捕获的语法错误:意外标记

但是,我有一个xml格式的数据源,每当我试图从中读取内容时,store reader就会抛出一个异常:

“未捕获的语法错误:意外标记<”

我没有权限修改数据源的格式,因此如何处理此问题

另外,我想知道SenCha Touch有哪些类型的阅读器

顺便说一下,以下是数据的内容:

<config generated_at="2014-04-16 16:39:12">  
    <acModes>A,D,O</acModes> 
    <acModeNames A="Arrival" D="Departure" O="All"/> 
    <acShapes B="ac-clone" C="ac-clone" Default="ud-clone" G="tp-clone" H="he-clone" J="ac-clone" M="ud-clone" P="tp-clone" R="ac-clone" T="tp-clone" U="ud-clone" Z="ud-clone"/> 
    <acColours> 
        <Unknown number="0"> 
            <A fill="0xffcc00" stroke="0x008000" stroke-width="1"/> 
            <D fill="0xffcc00" stroke="0x008000" stroke-width="1"/> 
            <O fill="0xffcc00" stroke="0x990066" stroke-width="1"/> 
        </Unknown> 
        <MEL number="1"> 
            <A fill="0xd10000" stroke="0xf40000" stroke-width="1"/> 
            <D fill="0x33" stroke="0xcc" stroke-width="1"/> 
            <O fill="0xffcc00" stroke="0x008000" stroke-width="1"/> 
        </MEL> 
    </acColours> 
    <trColours> 
        <Unknown number="0"> 
            <A fill="none" stroke="0xffcc00" stroke-opacity="0.7" stroke-width="150"/> 
            <D fill="none" stroke="0xffcc00" stroke-opacity="0.7" stroke-width="150"/> 
            <O fill="none" stroke="0x990066" stroke-opacity="0.7" stroke-width="150"/> 
        </Unknown>
     </trColors>
       ......many lines of xml content..........
     <nmts replicate="1" showPortables="1" tagfields="type,metric,starttime,endtime,maxtime,duration" visible="visible">
           <download_queue enable="0"/>
           <locations name="Keilor East" download_noise_data="1" latitude="-37.73228" locid="3" longitude="144.86900" monitor_location_id="318" monitor_name="mel3" status="active" tagOrientation="SE" type="fixed" x="2857.2" y="23539.3"/>
           <locations name="Bulla" download_noise_data="1" latitude="-37.60686" locid="2" longitude="144.82314" monitor_location_id="320" monitor_name="mel2" status="active" tagOrientation="SE" type="fixed" x="-2247.9" y="41177.8"/>
           <locations name="Coolaroo" download_noise_data="1" latitude="-37.66640" locid="6" longitude="144.92731" monitor_location_id="342" monitor_name="mel6" status="active"                tagOrientation="SE" type="fixed" x="9348.3" y="32808.1"/>
           <locations name="Essendon" download_noise_data="1" latitude="-37.73880" locid="4" longitude="144.90410" monitor_location_id="343" monitor_name="mel4" status="active" tagOrientation="SE" type="fixed" x="6764.6" y="22621.5"/>
           <locations name="Thomastown Fixed" download_noise_data="1" latitude="-37.67085" locid="61" longitude="144.99731" monitor_location_id="344" monitor_name="mel5" status="active" tagOrientation="SE" type="fixed" x="17140.6" y="32182.2"/>
           <locations name="Keilor Bonfield Res" download_noise_data="1" latitude="-37.72383" locid="60" longitude="144.83806" monitor_location_id="346" monitor_name="asa31" status="active" tagOrientation="SE" type="portable" x="-587" y="24728.6"/>
    </nmts>
</config>

谢谢你

没有“几乎是XML”的阅读器。如果您想解析看起来像XML但不是XML的东西,那么您需要编写一个自定义解析器。有3种读取器类型:JSON、Array、XMLHi@Jandalf,您是否也可以共享指向SenCha Touch中数据读取器类型的链接?谢谢:)它是JSONReader的一个子类。对于JSONP,格式必须是JSON。否则,服务器需要支持CORS。唯一的另一种选择是您有自己的服务器请求它,然后向服务器发出ajax请求。
Ext.define('myApp.store.myStore', {
    extend: 'Ext.data.Store',
    requires: ['myApp.model.myModel'],
    autoLoad: true,
    storeId: 'myStore',
    proxy: {
        type: 'jsonp',
        url: 'http://webtrak.bksv.com/mel/configuration',
        reader: {
            type: 'xml',
            rootProperty: 'nmts',
            record:'locations'
        }
    }
});