The HTML Tidy procedure I spelled out here is proving awkward. If I screw something up that Tidy can't fix, I wind up checking the document in an XML parser. A convenient parser is the one in MSIE, and lately I've been using it for this purpose. This is awkward too, however. For a few days, I tried this procedure:
But the edit/copy/check cycle is ridiculous. Couldn't I toggle the same file between two modes? Here's one approach. By adding this to the file:
I could view as XML and check well-formedness. Now toggling between HTML and XML modes was as simple as changing between "text/xml" and "text/html" and reloading. Here's are both views, for this in-progress document, in MSIE on Mac OS X:
What I didn't discover until later is that, for reasons I'm sure someone will explain to me, this doesn't work in MSIE 6. Not knowing that, I next attempted what seemed like a brilliant hack. Why not make a couple of bookmarklets to poke the META HTTP-EQUIV tags into the DOM? Then it'd be just a one-click deal to toggle from HTML to XML and back.
Here's a snippet that (in theory) does the HTML-to-XML switcheroo:
Mozilla's amazingly cool DOM inspector enables us to verify that the expected change was made. Here's the document in its default text/html mode:
And here's the document after clicking on that javascript: link to modify the META HTTP-EQUIV element:
It works! Except no, it doesn't. Although the DOM exactly matches the DOM obtained by reading in a file that originally contains an HTTP-EQUIV of text/xml, MSIE doesn't react to the dynamic change.
Sadly it's all kind of moot anyway. Safari won't parse XML, Mozilla parses without the XML viewer, but like MSIE 6 doesn't seem to want to let HTTP-EQUIV override the filename's extension. Ideas?
Former URL: http://weblog.infoworld.com/udell/2003/05/17.html#a693