开发者

how to Fetch data from an XML file with tags <title> <![CADTA[text here]]> </title>?

开发者 https://www.devze.com 2023-03-20 17:20 出处:网络
My XMl File <item> <title> <![CDATA[Stanford engineers build a nanoscale device for brain-inspired computing]]>

My XMl File

<item>

<title> <![CDATA[Stanford engineers build a nanoscale device for brain-inspired computing]]>

</title>

<link>

http://news.stanford.edu/news/2011/july/nano-synapse-computing-061211.html </link>

</item>

I am able to fetch easily from link by using the tag

alert(obj.item.link)

Now i want to fetch from the title tag ie."Stanford engineers build...." i have tried everything ie

alert(obj.item.title)

alert(obj.item.title.C开发者_运维百科DATA);

but none is working , any help


There is a good explanation of how to do this here: http://fczaja.blogspot.com/2007/04/accessing-cdata-section-in-xml-dom-from.html.

However, I'd suggest a jQuery-based solution to hide any browser differences. See this SO question: XML parsing of a variable string in JavaScript.

0

精彩评论

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

关注公众号