Monday, June 22, 2009

XHTML Validators Review, Part 1


OK, OK, I know I promised a post including reviews for all 5 XHTML validators but I realized pretty quickly that the post would be extremely long if I included all 5 so I broke it into 2 parts. The first post today will include a review of the W3C online validator and the HTML Tidy application.

W3C Markup Validation Service

The W3C markup Validation service is an online validator available on the W3C website.

Licensing

From what I can tell, this service is free to use for any web page. However, using a validated icon on a web page requires the page be previously validated by this service. Information about the icon licensing can be found on the validator help page.

Documentation

The validator has supporting User Guide and FAQ/help pages.

Features

The W3C validator can handle 3 different ways of inputting HTML documents for validation. You can check an online document via URI, upload a file, or directly enter a page markup in the service page. However, this service does not provide batch validation. Other options include Automatic character encoding and document type detection, markup cleanup (via HTML Tidy), and validation for error pages.

Test

The W3C validator did rather well in validating the test files. It detected all errors (or at least, gave warnings) for each test file. The markup correction was correct each time and allows the user to view the source right about the corrected markup. There were some annoyances though. Every time the validator ran, it would the file name field. While this wasn't that big of a deal, it was rather confusing to have a “Revalidate” button that didn't automatically re-validate the file previously validated. Also, the tidy option reset every time no code was cleaned up in the previous validation check. The validator also gave multiple error messages for each error, which more of less made the error messages useless without the built in markup cleanup. Other things to note is the validator assumes the DOCTYPE is transitional if you don't specify or it can't detect the type, so make sure to specify if you want your documents validated using the frameset or strict DOCTYPES.

Knee Jerk Conclusion – Use the W3C validator for single, static web pages. Otherwise, find something that has a batch execution option.

HTML Tidy

HTML Tidy isn't per se an XHTML validator. Rather, it is a library/command prompt application that cleans up XHTML markup of files. It can be found at http://tidy.sourceforge.net/.

Licensing

HTML Tidy is an open source project so it's free to use on both personal and commercial pages. The license is listed on the project website.

Documentation

HTML Tidy has plenty of documentation including an overview by Dave Raggett, a quick reference guide, user manual, an API, and a FAQ.

Features

It lacks a built in interface but there is one user interface available. Also, if you just run the command prompt version on a file, all results will be output to the command prompt which isn't quite useful. Luckily there are plenty of run options available such as specifying doctype, outputting errors and warnings to another file, and automatically updating the HTML file's contents to the cleaned up code. Tidy can also be run with a configuration file with custom tailored settings.

Testing

I decided not to use available user interface for the tests. This made it somewhat difficult to run the tests immediately, but after checking out the documentation I setup a batch file to run HTML Tidy on all of the test files at once. It assumed transitional DOCTYPE also, so I ran tidy with the DOCTYPE setting set a strict. The cleanup was the same as the W3C validator (as expected since HTML tidy is used for the W3C validator). I wasn't quite sure if the files were validated with the transitional or strict DOCTYPE because the files DOCTYPE in the files stayed as strict but the error output files said “Info: Document content looks like XHTML 1.0 Transitional”.

Knee Jerk Conclusion – I would recommend using this for web development projects with custom configuration in a build script rather than for manually for single pages.

Well thats it for today, tune in tomorrow for part 2, which will include reviews of the Validone, WDG, and SimpleTidy validators and a final comparison between all 5.

0 comments:

Post a Comment