views:

220

answers:

4

Currently when I build my site I have to manually open validate it at the 3wbc site (means when opera pops up, press ctr+alt+shft+u) for every page. Is it possible to automatically validate every page whenever I build my pages?

P.s.: This page doesn't validate ;)

+1  A: 

You could use the validator API:

http://validator.w3.org/docs/api.html

Ryan Doherty
+4  A: 

You can download and install your own copy of the validator - http://validator.w3.org/source/ - and invoke it locally instead of trekking out to w3.org for each page. Still, this requires piggybacking over a web server through plain HTTP or the API. For a simpler solution you may prefer to download the SP library - http://www.jclark.com/sp/index.htm or http://openjade.sourceforge.net/ - on which the W3 validator is based, then invoke the command 'nsgmls' from the command line.

There are of course also many desktop HTML validators that can process a batch of HTML pages at once, which may not be automated, but would certainly be much easier than manually checking each page. For example http://arealvalidator.com/ (Windows), http://www.webthing.com/software/validator-lite/install.html (Unix).

bobince
Thanks, I will look in your sollutions from bottom to top ;)
borisCallens
A: 

If you've got the HTML files in source control like SVN or Git, you can use a pre-commit hook script to run client-side validators on them. Or if you're feeling adventurous, you could use that method to ping another script on the server that validates the live pages...

Ant P.
That's on commit, not on build then; right?
borisCallens
A: 

Might not be best choice for you but there's an Ant task for this, XmlValidate.

Jeffrey Fredrick
Good to know, but how could this help me validate my HTML except for the correct opening and closing of tags?
borisCallens