Re: off line version

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 UTC