XML阅读器无法读取格式良好的xml

时间:2014-04-16 07:26:44

标签: extjs sencha-touch

我有一个xml格式的数据源但是,每当我尝试从中读取内容时,商店读者都会抛出异常:

“未捕获的SyntaxError:意外的令牌<”

我无权修改数据源的格式,所以我该如何处理这个问题呢?

此外,我想知道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>

这是代码:

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'
        }
    }
});

谢谢!!!

0 个答案:

没有答案