Page 1 of 1
Validate CSS $_POST using W3C validator?
Posted: Thu Jun 05, 2008 5:37 pm
by JAB Creations
My question is rather simple and I'll try to create a linear visual...
1.) User $_POST CSS data to form -->
2.) Server passes form data to W3C validator
3.) Validator returns 'valid' or 'invalid' result.
4.) Able to echo 'valid' or 'invalid' to the user.
So in essence I want to know if it's possible to validate CSS data on my site but using the W3C CSS validator?
Re: Validate CSS $_POST using W3C validator?
Posted: Thu Jun 05, 2008 6:06 pm
by Eran
You can send the request to the w3 validator SOAP service and parse the results.
http://jigsaw.w3.org/css-validator/api.html
Re: Validate CSS $_POST using W3C validator?
Posted: Thu Jun 05, 2008 6:57 pm
by JAB Creations
So essentially would I use PHP to read the XML file's m:validity element to simply check and see if the user's code posted to my site that I passed on to W3C's soap widget is valid or not?
Re: Validate CSS $_POST using W3C validator?
Posted: Thu Jun 05, 2008 7:07 pm
by Eran
Correct. You don't even have to use PHP - if you use AJAX to send the request, Javascript has excellent XML parsing and traversal capabilities.
Re: Validate CSS $_POST using W3C validator?
Posted: Thu Jun 05, 2008 7:22 pm
by JAB Creations
I'd actually prefer to have the server directly receive the validation in case the user disables JavaScript once at the form and then submits the data.
Are there any working examples/tutorials I can learn from?
Re: Validate CSS $_POST using W3C validator?
Posted: Fri Jun 06, 2008 6:39 am
by Eran
Not that I know of, but it seems pretty straightforward
Re: Validate CSS $_POST using W3C validator?
Posted: Fri Jun 06, 2008 10:39 am
by JAB Creations
If it seems straight forward and there are no tutorials or examples of code then could you please post some example so that I could actually learn how to use it?