how to Fetch data from an XML file with tags <title> <![CADTA[text here]]> </title>?
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.
精彩评论