# CSS Validation Service

Check Cascading Style Sheets (CSS) and (X)HTML documents with style sheets

## CSS Validator Web Service API
SOAP 1.2 validation interface documentation

### Table of Contents

### Validation Request Format

The documentation on how to create a custom request to the CSS validation service is available, with a table of all existing parameters and their values, in the User Manual.

### SOAP format description

When called with parameter `output=soap12`, the validator will switch to its SOAP 1.2 interface. Below is a sample response, as well as a description of the most important elements of the response.

A WSDL 2 description file is lso available for this service.

#### sample SOAP 1.2 validation request

It is a simple HTTP GET call to a URI like:

`https://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fwww.w3.org%2F&warning=0&profile=css2`

#### sample SOAP 1.2 validation response

A SOAP response for the validation of a document (invalid) will look like this:

    <?xml version='1.0' encoding="utf-8"?>
    <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
      <env:Body>
        <m:cssvalidationresponse
           env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"
           xmlns:m="http://www.w3.org/2005/07/css-validator">
          <m:uri>http://www.w3.org/</m:uri>
          <m:checkedby>http://jigsaw.w3.org/css-validator/</m:checkedby>
          <m:csslevel>css2</m:csslevel>
          <m:date>2006.02.23T01:19:57Z</m:date>
          <m:validity>true</m:validity>
          <m:result>
            <m:errors xml:lang="en">
              <m:errorcount>0</m:errorcount>
            </m:errors>
            <m:warnings xml:lang="en">
              <m:warningcount>79</m:warningcount>
              <m:warninglist>
                <m:uri>https://www.w3.org/StyleSheets/home.css</m:uri>
                <m:warning>
                  <m:line>85</m:line>
                  <m:level>0</m:level>
                  <m:message>Properties for other media might not work for usermedium</m:message>
                </m:warning>
              </m:warninglist>
              <m:warninglist>
                <m:uri>https://www.w3.org/StyleSheets/home-import.css</m:uri>
                <m:warning>
                  <m:line>167</m:line>
                  <m:level>0</m:level>
                  <m:message>Properties for other media might not work for usermedium</m:message>
                </m:warning>
                <m:warning>
                  <m:line>349</m:line>
                  <m:level>0</m:level>
                  <m:message>Properties for other media might not work for usermedium</m:message>
                </m:warning>
                <m:warning>
                  <m:line>362</m:line>
                  <m:level>0</m:level>
                  <m:message>Properties for other media might not work for usermedium</m:message>
                </m:warning>
              </m:warninglist>
            </m:warnings>
          </m:result>
        </m:cssvalidationresponse>
      </env:Body>
    </env:Envelope>

#### SOAP1.2 response format reference

element | description
--- | ---
cssvalidationresponse | The main element of the validation response. Encloses all other information about the validation results.
uri | the address of the document validated. In EARL terms, this is the `TestSubject`.
checkedby | Location of the service which provided the validation result. In EARL terms, this is the `Assertor`.
csslevel | The CSS level (or profile) in use during the validation.
date | The actual date of the validation
validity | Whether or not the document validated passed or not formal validation (boolean)
errors | Encapsulates all data about errors encountered through the validation process
errorcount | a child of errors, counts the number of errors listed
errorlist | a child of errors, contains the list of errors (surprise!)
error | a child of errorlist, contains the information on a single validation error.

Note: `warnings`, `warningcount`, `warninglist` and `warning` are similar to, respectively, `errors`, `errorcount`, `errorlist` and `error`.

#### SOAP1.2 atomic message (error or warning) format reference

As seen as the example above, the children of the `error` element, but also the `warning` element are `line`, `level` and `message`, defined below:

element | description
--- | ---
line | Within the source code of the validated document, refers to the line where the error was detected.
level | The level of the warning, only the ones whose level is under or equal to the value specified in the request will be displayed.
message | The actual error or warning message