开发者

Read XML using Sencha

I am about to develop a application using Sencha touch. The issue I am facing right now is Sencha code should read the following XML ( "data.xml" and display News, Articles...), any expert that can help here please ?

    <ns2:categories>
<category>
 <catId>96</catId>
 <title>News</title>
</category>
<category>
 <catId>97</catId>
 <title>Articles</title>
</category>
</ns2:categories>

And when I click on News as an example should read that particular "recordId" element in "data_read.xml" and display "origUrl","title","data" .the data_read.xml looks like below..

<ns2:records>
<record>
<recordId>96</recordId>
<title>123 Lifted</title>
<author>|</author>
<published>2010-01-20T14:36:00.000-08:00</published>
<origUrl>
http://www.abc.com/</origUrl>
<numComments>0</numComments>
<data>
<![CDATA[<p>According to a report on sd asdas das asdasd  asdasd hjjasd .</p>
<p> </p>
<p>This is a landmark vote, and a harbinger of change for this extremely traditional area that also has banned the use of metal r bolt.</p>
<p> </p>
<p>Check out: abc.com and xyz .com for more information开发者_Go百科.</p>
<p class="modifydate">Last Updated (Wednesday, 20 January 2010 22:36)</p>]]>
</data>
</record>
</ns2:records>

Is this possible in Sencha ?


Check out the Ext.data.XmlReader class and see if it does what you need:

http://dev.sencha.com/deploy/touch/docs/?class=Ext.data.XmlReader


I suspect the XML reader is not properly handling CDATA (read about CDATA here) parsing but will have to go back and look at it later. A possible alternative is preparsing the xml to remove CDATA.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜