Friday, May 20, 2011

How Internet Explorer versions handle bad-formed XML files

Following the change from Beta to RTM Version of IE 9 in display of XML files feature we continue to work with IE using it to display XML files in certain situations.
Well, after the IE9 RC version turned back to “traditional” XML data display format, the problem seems to be solved.
But there’s a significant change in this functionality of Internet Explorer 9 and Internet Explorer CTP 10 in XML data display policy: this time it is about the bad-formed XML files.
Assume a well-formed XML file:
<root>
<element name="3" />
sample text
<element name="1" />
<element name="2" />
</root>
 
This file is displayed properly in IE8:
 
x10sctmp2
in IE9:
 
x10sctmp0
 
and in IE10:
x10sctmp1
 
Then we try following bad-formed XML data:
<root>
sample text
<element name="1" />
<element name="2" >
<element name="3" />
</root>

(the element [element name=”2”] has no closing tag)

This file is displayed in IE8 as expected:

x10sctmp3

The IE9 displays the same data as follows:

x10sctmp4

Neither the error notification nor any explanation are presented to the user. Via the option “View Source” you can see the source XML data, but again – no error information exists:

x10sctmp5

The same for HTML view in Developer Tools Window (activated by F12):

x10sctmp6

And only Console view:

x10sctmp7

and Script view provide us with error information:

x10sctmp8

Same behavior shows also the IE10 CTP:

x10sctmp9 x10sctmp10

Using “Force IE7” … “Force IE9” mode doesn’t affect this behavior.

The FireFox 4 displays the same well-formed XML:
x10sctmp11

and bad-formed as expected from previous FF versions:
x10sctmp12

This difference in handling of bad-formed XML data may be essential for a custom application using web browser to display XML data. Just keep it in mind…

No comments: