W3C home > Mailing lists > Public > www-validator@w3.org > May 2008

Re: off line version

From: olivier Thereaux <ot@w3.org>
Date: Thu, 29 May 2008 12:49:51 -0400
Cc: "Nikita The Spider The Spider" <nikitathespider@gmail.com>, www-validator@w3.org
Message-Id: <901A30F4-2987-4712-892A-DD848542016C@w3.org>
To: Gabor Szabo <szabgab@gmail.com>


On 26-May-08, at 1:46 AM, Gabor Szabo wrote:
> Thanks, that I can install on my machine but it still provides only a
> web interface.

Actually the perl CGI module is very cool, it allows you to call the  
script from the command line too.

First, maake sure that the environment variables are set (not needed  
if you installed the config files in /etc/w3c )

$ export W3C_VALIDATOR_CFG=path/to/validator/htdocs/config/validator- 
local.conf
$ cd path/to/validator/httpd/cgi-bin

then
$ ./check uri=http://www.w3.org/
... will give you the html output. Not bad, but a bit verbose.

One trick is to grep for the custom HTTP headers the validator sends

$ ./check uri=http://www.example.com | grep X-W3C-Validator
X-W3C-Validator-Recursion: 1
X-W3C-Validator-Status: Invalid
X-W3C-Validator-Errors: 1
X-W3C-Validator-Warnings: 2

Or you can also use one of the alternate outputs, which tend to be  
more terse.

e.g:
$ ./check uri=http://www.google.com output=n3
...
-> http://validator.w3.org/docs/users.html#Output

> Is there a version that provide a command line interface or an API
> that I can call
> and get back if the page is valid or not?


There's a web services API:
http://validator.w3.org/docs/api

HTH,
-- 
olivier
Received on Thursday, 29 May 2008 16:50:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:29 GMT