0
DOM Scripting - accessing XML CDATA values
Explorer
,
/t5/coldfusion-discussions/dom-scripting-accessing-xml-cdata-values/td-p/1957579
Jun 11, 2009
Jun 11, 2009
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>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Enthusiast
,
/t5/coldfusion-discussions/dom-scripting-accessing-xml-cdata-values/m-p/1957580#M100855
Jun 12, 2009
Jun 12, 2009
Copy link to clipboard
Copied
I think you will have more success on a JavaScript forum.
Mack
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
matthisco
AUTHOR
Explorer
,
LATEST
/t5/coldfusion-discussions/dom-scripting-accessing-xml-cdata-values/m-p/1957581#M100856
Jun 12, 2009
Jun 12, 2009
Copy link to clipboard
Copied
Thanks
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

