2011-01-28 62 views
5

我即將開發一個使用Sencha touch的應用程序。我現在面臨的問題是Sencha代碼應該讀取以下XML(「data.xml」並顯示新聞,文章...),請幫助這裏的任何專家?使用Sencha讀取XML

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

當我在新聞點擊作爲一個例子應該閱讀特定「的recordId」元素「data_read.xml」,並顯示「origUrl」,「標題」,「數據」 .the data_read.xml樣子以下..

<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.</p> 
<p class="modifydate">Last Updated (Wednesday, 20 January 2010 22:36)</p>]]> 
</data> 
</record> 
</ns2:records> 

這可能在Sencha?

回答

0

我懷疑XML閱讀器不能正確地處理CDATA(瞭解CDATA here)的解析,但會不得不回過頭去看看。一種可能的選擇是準備XML來刪除CDATA。