ANN: Web 2.0 Mashup Ajax JavaScript Json Web Standards Validator Poniez <3

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

ANN: Web 2.0 Mashup Ajax JavaScript Json Web Standards Validator Poniez <3

Bjoern Hoehrmann


  I wrote a DOM-based XML DTD Validator in ECMAScript. It cannot parse
DTDs, but given a DTD in a custom format, it will validate an element or
an entire document against that DTD. It comes with pre-defined DTDs for
XHTML 1.0 Strict, XHTML 1.0 Transitional, and XHTML 1.1. A demo is
available at

The code is available at

It should work with HTML and XHTML documents; for XHTML documents, if
the browser ensures that the document is well-formed, this Validator is
as powerful (or limited) as the W3C Markup Validator with the following
caveat: attributes of types ID/IDREF/NMTOKEN/NMTOKENS are not checked
for proper syntax; this is simply because I did not bother writing the
regular expressions for these types.

While the code is not particularily optimized, on my computer the SMIL
2.0 specification's single-file version (~ 2.00 MB) is validated in 8s
by Opera 9, in 20s by Firefox trunk, and in ~ 100s by IE6, which is a
bit funny considering IE6 loads the document faster by some orders of

You can use this Validator e.g. to validate user comments if you allow
XHTML code somewhere, your own code, e.g. to conditionally display a
"valid" / "invalid" icon on your homepage for improved quality testing,
or you can modify the pre-defined DTDs to provide better validation as
the Markup Validator.

Converting DTDs into the format required by this tool is rather simple,
but my tools to do that are too crude to publish. If you would like to
use the Validator with any DTD not provided inline, please let me know
and I might consider converting it, if possible.

The code is huge unless gzip-compressed as I've done it above. The
compressed version is currently 9999 bytes. If you use only e.g. the
XHTML 1.0 Strict DTD and use one of the common compactor tools to
strip comments and such, and then compress it again, it is possible
to reduce the size to about 3.5 KB.

I do not intend to continue development of this tool, if you like to
take it over, please let me know.

Björn Höhrmann · mailto:[hidden email] ·
Weinh. Str. 22 · Telefon: +49(0)621/4309674 ·
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 ·