Blogidate XML well-formedness
In a comment on my previous blog post, Simon Willison writes: "I'm not too keen on popping up a new window with an external validation service. How about an alternative bookmarklet that just validates XML well-formedness (essential for those of us who use XHTML)?"
Try the new blogidate well-formedness bookmarklet. If this bookmarklet finds an error, it turns the textarea red, selects the part of the textarea where the error is, and puts the error message in the status bar (not in a dialog). If it doesn't find an error, it turns the textarea green.
Update Jan 21, 2005: added a normalize() call so the bookmarklet won't fail when the XML is more than a few kilobytes.
Update Sept 2, 2005: the Valid XHTML user script, which is based on this bookmarklet, is even more cool.
August 26th, 2003 at 7:51 am
Great bookmarklet, I was thinking of that (validating with the Mozilla parsing machine) regarding your previous post.
I think, like Simon said, that you could use the DOMParser object also for validating, because I think if the DOMParser can’t parse the content, it displays the error document. I’m not sure though, and with the iframe method it works just as nicely :)
August 27th, 2003 at 7:09 am
Wow, very cool! It doesn’t seem to like non-breaking space elements ( ) though.
August 28th, 2003 at 12:58 am
This makes it also possible to automatically correct bad html, by using for the created iframe data:text/html and copying the content of the textarea to the iframe and then copy it back. Mozilla automatically corrects the tag soup.
It’s not xhtml though.
By the way, I tried to access the frame with the window.frames collection, but there I got a permission denied, which was logical I thought, because It’s a different URL (e.g. data:). But then I saw that you could access the iframe with contentdocument which is way better anyhow.
But why the difference?
August 27th, 2003 at 4:23 am
Validating Your Posts
I mentioned briefly the importance of checking your blog post syntax for correct validation. Thanks to Jessie Ruderman, your post validation is now just a simple bookmarklet click away. Jessie has written a bookmarklet that allows you to check your…
September 19th, 2003 at 1:36 pm
Jesse Ruderman: Blogidate XML well-formedness
(SOURCE :”jonu”)- Cool hack! Gotta try this.
February 18th, 2004 at 3:04 am
blogidate xml-well-formedness
a nice bookmarklet wich validates XML well-formedness in textareas. this can come in very handy when you want to validate your posts. <quote>If this bookmarklet finds an error, it turns the textarea red, selects the part of the textarea where…
July 28th, 2004 at 12:26 am
A Quote Blogmarklet
Jon Udell, in referencing Jesse Ruderman’s well-formed bookmarklet reminded me that I’ve been meaning to create a small bookmarket of my own.