views:

138

answers:

5

I'm a web developer who is increasingly using Vim to code web sites. Are there any HTML validation utilities (or techniques) out there that will take whatever file I'm working on and validate against its DOCTYPE without leaving the shell?

T

+1  A: 

Try an XML validator with the appropriate Schema/DTD.

Here's a validator: http://xmlstar.sourceforge.net/

Various DTDs available here: http://www.w3.org/TR/xhtml1/dtds.html

gWiz
A: 

You can write a script that wget the response from validator service (see http://validator.w3.org/docs/api.html for parameters). You can either just check the header of the response or parse the xml response and output the way you want it.

Kasumi
I looked into this and it seems that the W3C discourages you from using this service too often. They have instructions on how to set up your own local validator here: http://validator.w3.org/docs/install.html.
Thomas
A: 

I'm interested in a solution that works in the shell, too. At the moment I use Firefox and the HTML Validator Plugin.

vbd
+2  A: 

You can use tidy together with a small Vim script.

+1  A: 

Get yourself tidy from sourceforge and execute it on the shell
tidy -errors -q -f error_file.txt the_file.html

René Nyffenegger