W3C home > Mailing lists > Public > www-validator-css@w3.org > January 2010

Re: validate from a Java program: how to send CSS and receive results

From: Francois Daoust <fd@w3.org>
Date: Mon, 11 Jan 2010 13:23:22 +0100
Message-ID: <4B4B183A.40305@w3.org>
To: www-validator-css@w3.org
Hi Erik,

I do not think you are doing anything wrong, actually.
Your code works fine when I change the target URL to target some other 
The CSS validator must be expecting something it doesn't get, not sure 
what it is.

Depending on what you actually want to do with the results returned by 
the CSS validator, you may consider using the CSS validator directly 
within your project instead of sending an HTTP request.

Instructions to get the source code of the CSS validator are available at:

In particular, a JAR package of the CSS validator is available at:

Once your project references the JAR, all you need to do is to create an 
instance of:

... and use its "parseStyleElement" method, after having initialized an 
application context (ApplContext) with the validation settings you need 
(encoding, CSS validation level, language, ...)

You can find code that just about the same thing in the source of the 
mobileOK Checker, in the CSSUtils#getStylesheet method:

(Please note that some settings and classes used in those lines are 
rather specific to the mobileOK Checker, but that should give you a 
rough idea about how this can be done).

Received on Monday, 11 January 2010 12:23:54 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:40:46 UTC