No More “XML Parsing Failed” Errors

Through our Open The Web effort, Opera's Developer Relations team contacts websites that don't work as expected when viewed in Opera, and we suggest changes to their source code that fix the problem.

One of the more common problems we've encountered are sites that somehow serve broken XML to Opera. You can see this on http://www.sharebuilder.com/, http://allhiphop.com/, http://www.excalibur.com/, http://home.mcafee.com/Default.aspx, just to name a few.

The reason for this are broken server setups: when identifying as Opera, certain sites seem to be sending their content 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: at the smallest error in an XML document, Opera (and other browsers) will throw an "XML parsing failed" message, and a link to "Reparse document as HTML". For non-technical users, this is very confusing, and for advanced users, it's a nuisance.

Over the last couple of years, we've contacted all sites we found are breaking like this, and asked Microsoft to fix the ASP.NET sniffing problem, which they've done. However, as the rollout of this update takes time, there are still a number of sites broken, and it seems like this situation will be with us for quite some time to come.

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.

Image showing no more XML parsing errors

If you want to play around with this, grab the latest Opera Next build from the Opera Desktop team blog (or wait for the automatic update), and let us know what you think.