J
jottevanger
Is it me, or is innerHTML in IE7 (and as far as I can tell createNode
and importNode) rewriting the HTML to upper case and removing most of
the quotation marks? I am trying to copy XHTML into an XML document and
this makes for invalid XML so I can't transform it. Here is some test
code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="JavaScript" type="text/javascript">
function getSomeXml(id){
var xmlDoc= new ActiveXObject("Msxml2.FreeThreadedDOMDocument.5.0");
xmlDoc.async = false;
xmlDoc.loadXML(document.getElementById(id).innerHTML);
var stylesheet = new ActiveXObject("Msxml2.DOMDocument.5.0");
stylesheet.async = false
stylesheet.load("test.xslt");
if (stylesheet.parseError.errorCode != 0) {
var myErr = stylesheet.parseError;
alert("You have error " + myErr.reason);
}
else
{
alert("Look what innerHTML is doing to my stuff: " +
document.getElementById(id).innerHTML);
alert("This is what xmlDOc now contains: " + xmlDoc.xml)
}
}
</script>
</head>
<body>
<p><a href="javascript:getSomeXml('one')">Try with attributes</a></p>
<div id="one">
<div class="ihaveanattributeandwillscrewthisup">ooh la la!</div>
</div>
<p><a href="javascript:getSomeXml('two')">Try without
attributes</a></p>
<div id="two">
<div>ooh la la!</div>
</div>
</body>
I'd be grateful for any insights into this and especially for
workarounds.
Many thanks, Jeremy
and importNode) rewriting the HTML to upper case and removing most of
the quotation marks? I am trying to copy XHTML into an XML document and
this makes for invalid XML so I can't transform it. Here is some test
code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="JavaScript" type="text/javascript">
function getSomeXml(id){
var xmlDoc= new ActiveXObject("Msxml2.FreeThreadedDOMDocument.5.0");
xmlDoc.async = false;
xmlDoc.loadXML(document.getElementById(id).innerHTML);
var stylesheet = new ActiveXObject("Msxml2.DOMDocument.5.0");
stylesheet.async = false
stylesheet.load("test.xslt");
if (stylesheet.parseError.errorCode != 0) {
var myErr = stylesheet.parseError;
alert("You have error " + myErr.reason);
}
else
{
alert("Look what innerHTML is doing to my stuff: " +
document.getElementById(id).innerHTML);
alert("This is what xmlDOc now contains: " + xmlDoc.xml)
}
}
</script>
</head>
<body>
<p><a href="javascript:getSomeXml('one')">Try with attributes</a></p>
<div id="one">
<div class="ihaveanattributeandwillscrewthisup">ooh la la!</div>
</div>
<p><a href="javascript:getSomeXml('two')">Try without
attributes</a></p>
<div id="two">
<div>ooh la la!</div>
</div>
</body>
I'd be grateful for any insights into this and especially for
workarounds.
Many thanks, Jeremy