3

I am trying to open http://www.x.org/releases/current/doc/man/man3/xcb_grab_keyboard.3.xhtml in Firefox, but it fails with a XML parsing error. Chromium has a similar issue with it, but it shows at least the document until the error.

Both results are unwanted, I just want to get the page parsed as HTML. What options do I have other than using a different browser?

Lekensteyn
  • 6,982

2 Answers2

4

For static documents, the following bookmarklet will work as intended: The XHTML document will be displayed as (not-so-strict) HTML.

javascript:(function(){
 var x = new XMLHttpRequest();
 x.open('GET', location.href);
 x.onload = function() {
   var d = document.implementation.createHTMLDocument('');
   d.documentElement.innerHTML = x.responseText.replace(/^[\S\s]*?<html\b/i, '<html');
   document.replaceChild(d.documentElement, document.documentElement);
 };
 x.send();
})();

I'm stripping the first characters up to the <html> tag. Otherwise, everything ends up in the <body> tag. Consequently, styles (and scripts) would not be applied quite well.

Rob W
  • 2,283
  • 2
  • 24
  • 23
1

If it's only once in a while, you can devote a bit of manual effort. When you see the XML parsing error, you can go back, right-click on the link, and choose "Save link as". Then edit your copy of the HTML to correct the error. Open your corrected copy in your browser.

By deleting the "</table>" tag that was noted in the parsing error, I was able to view the page that you indicated.

minopret
  • 535
  • 4
  • 11