views:

110

answers:

2

I was wondering where I can find some information how IE8 actually handles xml header... for example how is handling <?xml version="1.0" encoding="utf-8"?> different to <?xml version="1.0"?>. Or how is handling processing node different in ie and other browsers.

One other questions would be how FF handles those header. Is it any different? If it is, what are the differences exactly.

/Marko

A: 

how is handling <?xml version="1.0" encoding="utf-8"?> different to <?xml version="1.0"?>

It isn't. The default encoding is utf-8, so including or omitting that part of the declaration makes no difference.

In any case when you are talking about browsers handling XHTML pages served as text/html MIME type, the encoding in the XML Declaration is ignored; only the <meta> tag (and, of course, the real HTTP header it is based on) has any effect. There is only a difference in browsers if you are serving them different types (eg. text/html to IE and application/xhtml+xml to the others). Don't do that.

Including the XML Declaration at all in an XHTML-as-HTML document causes IE6 to render the document in Quirks Mode, but that's fixed in later versions.

You should not include an XML Declaration in XHTML-as-HTML, and it's IMO of highly doubtful utility even in native XML, as the default version and encoding are almost always the values you want.

bobince
A: 

It seems that there are some small differences in how js engines in IE and other browsers handle xml header... in ie using sth like data.firstChild returns xml header and in ff and chrome using data.firstChild returns root element... data object holds the xml data fetched from a file. for example with jquery that would be $.ajax({ url: 'test.xml', success: function(data) { .... } });

markovuksanovic
I know that this is not only related to header. I would say that it is related to overall xml document handling within js engine.
markovuksanovic
The following thing is not directly related to the questions - but isn't very far away either - using document.childNodes in ie will fetch child nodes which will have header (processing node) included while other browsers will not.
markovuksanovic