One of the nodes of my XML file has HTML within a CDATA
tag. I need to get the HTML out and render it on my page.
<student>
<student_id>
Tijuana
</student_id>
<student_classes>
<![CDATA[
<ul>
<li>class 1</li>
<li>class 2</li>
</ul>
]]>
</student_classes>
</student>
If I try to get the node text, it removes all the HTML and just gives me plain text.
$.ajax({
type: "GET",
url: "students.xml",
dataType: "xml",
success: xmlParser
});
function xmlParser(xml) {
//Returns a string like "class 1 class 2"
var blah = $(xml).find('student_classes').text());
}
What I need is to get the HTML inside of the CDATA tag so I can actually use it on my page. How can I do this? Using Javascript or jQuery. Here is what I need from the student_classes
node:
<ul>
<li>class 1</li>
<li>class 2</li>
</ul>