从xml中的编码标签中提取数据

时间:2013-07-10 08:58:24

标签: javascript xml titanium extract encode

我正在处理Feed并试图解析以下标记:

<content:encoded>
<![CDATA[
<p><strong><a href="http://www.highlandradio.com/wp-content/uploads/2013/07/sf.jpg"><img class="aligncenter size-full wp-image-54126" alt="sf" src="http://www.highlandradio.com/wp-content/uploads/2013/07/sf.jpg" width="210" height="240" /></a>A SF Cllr in Strabane has denied allegations that they assaulted a member of the SDLP party.</strong></p> <p>On Sunday the PSNI confirmed they were investigating an incident after they received a report of an assault in the early hours of Saturday morning.</p> <p>The Sinn Fein Cllr, who cannot be named for legal reasons, said that they totally deny the allegations that have been reported to the PSNI by the SDLP.</p> <p>The Cllr also said that they are seeking legal advice in relation to what they called &#8220;highly prejudicial&#8221; comments made by SDLP members on social media websites and to the local media.</p> <p>Sinn Fein says the allegations made have been presented as fact by the SDLP, which has attempted to subvert the Cllrs right to due legal process.</p> <p>And the statement concludes that the comments made by some SDLP members are unsubstaniated, and, as of yet un-investigated.</p> <p>Earlier this week the SDLP claimed that a representative in Strabane had been assaulted by a Sinn Fein Cllr over the weekend.</p> <p>&nbsp;</p>
]]>
</content:encoded>

我对该主题只有基本的知识并且正在尝试:

for (var i=0;i<items.length;i++) {
        data.push({
            title: items.item(i).getElementsByTagName("title").item(0).text,
            content: item(i).getElementsByTagName("content: encoded").item(0).text,
            className: "TableRow", 
            hasChild: true, 
            js:"external.js", 

        });

这是内容标记引发错误。任何人都可以帮我解释这个问题吗?我正在使用钛,但它基本上只是javascript。我需要图像和描述

1 个答案:

答案 0 :(得分:1)

(“content:encoded”)中有空格,请将其删除并重试。