Opera reparses as HTML when XML parse fails

Of possible interest to those wrestling with HTML/XML interop:

 From Andreas Bovens [1] by way of Sam Ruby's blog [2] (the latter has an 
interesting comment thread). Opera is, at least in some cases, punting back 
to a forgiving HTML parse when strict XML rules result in an error.

The situation they're dealing with is a bit odd. Quoting Andreas:

"...certain sites seem to be sending their content [to Opera] with a MIME 
type of application/xhtml+xml, whereas they send the same content to other 
browsers with a MIME type of text/html. The reason for this is unclear, but 
it certainly has to do with broken server-side browser sniffing. We've 
identified that the issue occurs on certain versions of ASP.NET, but there 
are also other examples where only Opera gets application/xhtml+xml, while 
other browsers get text/html.

Now, application/xhtml+xml content would not give any trouble if the XHTML 
code on these sites was well-formed, but unfortunately, mistakes are easily 
made..."

"[...]"

"Hence, we've decided to stop throwing draconian XML parsing failed error 
messages, and instead, attempt to reparse the document automatically as 
HTML. Instead of showing an error message in the browser, it's now dumped 
to the console, so as a developer, you can still find XML parsing error 
warnings in Opera Dragonfly and the Error Console if you want to."

Noah

[1] http://my.opera.com/ODIN/blog/2011/09/28/no-more-xml-parsing-failed-errors
[2] http://intertwingly.net/blog/2011/10/03/No-more-XML-parsing-failed-errors

Received on Wednesday, 14 December 2011 03:56:18 UTC