How would one go about embedding XML in a HTML page?
I was thinking using CDDATA would be the best approach but I get errors in the HTML document when the page loads.
<script><![CDATA[ ... ]]></script>
I’m needing to embed a XML document for fetching later with JavaScript. I need to do this since when the user opens it, they might not have internet access.
As long as the XML doesn’t contain
</script>anywhere, you can put it inside the script tags with a customtypeattribute (and no CDATA section). Give the script tag anidattribute so you can fetch the content.http://jsfiddle.net/hJuPs/