Copy link to clipboard
Copied
HI Folks,
Not sure if this is the write forum, but I'm trying to use Javascript to output XML values onto my webpage, see below.
This works fine, but when I try and get he values in a CDATA tag, I get undefined or null.
Can anyone please tell me how to get CDATA content?
<script type="text/javascript"
xmlDoc=loadXMLDoc("news.xml");
x=xmlDoc.getElementsByTagName('title');
for (i=0;i<x.length;i++)
{
document.write(x.childNodes[0].data);
document.write("<br />");
}
</script>
XML
<items>
<item>
<title>
<![CDATA[text goes in here]]>
</title>
</item>
</items>
Copy link to clipboard
Copied
I think you will have more success on a JavaScript forum.
Mack
Copy link to clipboard
Copied
Thanks