Quantcast
Channel: Internet Explorer 8, 9, 10 Forum
Viewing all articles
Browse latest Browse all 1908

Problem in IE10 to retrieve xml data from HTML document using innerHTML

$
0
0

In my HTML document I have embedded following XML document using the xml HTML elements (<xml id="xmldata">...</xml>) :

<xmlid="xmldata" xmlns:msxsl="urn:schemas-microsoft-com:xslt"><xdata><instance><booktype><name/></booktype></instance><langid="en"><binds><bindnodeset="booktype/name"required="true()" type="string"/></binds><guiTypes><inputref="booktype/name"><label>Name</label></input></guiTypes></lang></xdata></xml>

I use following code to retrieve the xml in javascript :

var parser =new DOMParser();
var doc = parser.parseFromString(document.getElementById("xmldata").innerHTML,"text/xml");
var serializer =new XMLSerializer();
strXml = serializer.serializeToString(doc);

The code works fine in IE9, but fails in IE10 on the second line (parser.parseFromString). I also noticed that the value document.getElementById("xmldata").innerHTML returned by IE9 differs from the value returned by IE10 which is completely wrong!.

document.getElementById("xmldata").innerHTML returned by IE9 (correct)

<xdata><instance><booktype><name /></booktype></instance><lang id="en"><binds><bind nodeset="booktype/name" required="true()" type="string" /></binds><guiTypes><input ref="booktype/name"><label>Name</label></input></guiTypes></lang></xdata>

document.getElementById("xmldata").innerHTML returned by IE10 (completely wrong)

<xdata><instance><booktype><name></name></booktype><lang id="en"><binds><bind nodeset="booktype/name" required="true()" type="string" /></bind><guiTypes><input ref="booktype/name"><label>Name</label></input></guiTypes></binds></lang></instance></xdata>


Does anybody know what's going on here ? Why does IE10 behave different from IE9.


Viewing all articles
Browse latest Browse all 1908

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>