views:

102

answers:

1

Hey,

I have the css-validator.war provided by W3C running locally on JBoss.

I have whipped together a very quick script to test it out:

require 'net/http'
require 'uri'

doc = '
* html {
    font-family: tahoma;
    background-color: black;
}
'

res = Net::HTTP.post_form(URI.parse('http://localhost:8080/css-validator/validator'),
  {'uri' => 'none', 'profile' => 'css2','usermedium' => 'all', 'type' => 'none', 'lang' => 'en', 'warning' => '1', 'output' => 'soap12', 'text' => doc})

response = res.body

puts response

When I browser to the validator in my web browser I can paste the CSS in fine and it validates fine but when I run this script I get an error page saying:

I/O Error: You have sent an invalid request.

I have checked the parameters that I am passing and they seems fine.

Does anyone have any idea why this would be happening?

Cheers

Eef

A: 

I found a gem called w3c_validators which provides CSS, Markup and Feeds validation.

gem install w3c_validators

Hope someone finds this useful.

Eef