W3C CSS Validator FAQ

This document contains the most frequently asked questions about the W3C CSS Validator. If you have further questions, feel free to send them to the www-validator-css@w3.org mailing list (Archive). Please send comments to the author of this FAQ. There is a list of other W3C related FAQs available.

What does org.xml.sax.SAXException: Please, fix your system identifier (URI) in the DOCTYPE rule mean?

Your document contains a document type declaration but the system identifier points at some non-W3C URI. Your document probably contains something like this:

<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

If your document is located at e.g. http://my.example/ this relative system identifier would point at http://my.example/DTD/xhtml1-strict.dtd and the DTD probably isn't available there, so you have to fix the system identifier to point at some valid URI. Consider these examples for XHTML 1.0:

<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"

What does I/O Error: Unknown mime type: some/type mean?

Cascading Style Sheets must be labeled as text/css, see RFC 2318, "The text/css Media Type" for details. Your server must be configured to return this MIME type in the Content-Type HTTP header. If you don't know how to setup your server to return this Media Type, check your webserver's manual or contact your system administrator or the support of your hosting company and ask them to make this change for your.

What does An invalid XML character (Unicode: 0x????) was found in the element content of the document mean?

Either your document contains characters disallowed by XML 1.0 (see Section 2.2 of XML 1.0 for details) or your document isn't encoded as expected. The default encoding for XML documents is either UTF-16 or UTF-8. If your document contains disallowed characters you have to remove them. If you document uses another encoding then UTF-8 or UTF-16 you have to declare this encoding, typically in the XML declaration. For ISO-8859-1 encoded documents this would look like

<?xml version='1.0' encoding='ISO-8859-1'?>

You may also declare the encoding in the HTTP Content-Type header, e.g.

Content-Type: application/xml;charset=ISO-8859-1

Refer to your web servers manual how to do so.

What does Element type "example" must be followed by either attribute specifications, ">" or "/>" mean?

Your XHTML/XML document is not well-formed; it probably includes directly adjacent attribute specifications like:

  <div xml:lang="de"lang="de">

This is not allowed in XML, there must be a white-space character between the attribute specifications, so write:

  <div xml:lang="de" lang="de">

The W3C Markup Validator is unable to find such problems due to its limited XML support (as pointed out in the results of the Markup Validator).

What does I/O Error: Not Acceptable mean?

The remote webserver returned an error code, probably 406 "Not Acceptable". This means that the requested resource is not acceptable for the CSS Validator due to the Accept-* headers it sent. If the CSS Validator requests e.g. http://www.example.org/style the HTTP request would look similar to

GET /style HTTP/1.1
Cache-Control: no-cache
Connection: keep-alive
Date: Mon, 07 Jul 2003 21:22:44 GMT
Pragma: no-cache
Accept: text/css,text/html,text/xml,application/xhtml+xml,
Accept-Language: de,en
Host: www.example.org
User-Agent: Jigsaw/2.2.0 W3C_CSS_Validator_JFouffa/2.0

Note that the value of the Accept-Language header is copied from your browsers request. The value de, en means that you have configured your browser to accept content in either german or english. If the requested resource is available in japanese and french but not in german or english, you will get the Not Acceptable error. Likewise for the Accept header.

If the resource you are trying to validate is generated by some scripting language like PHP and you get this error, the web server is probably misconfigured. If it's an Apache webserver, there is probably a line like

AddType application/x-httpd-php .php

in one of the configuration files. You should use the AddHandler directive instead. Check with your webmaster or web hosting provider if you don't know how to change the configuration.

Why does the validator complain You have no background-color with your color?

If you don't specify color and background-color at the same level of specificity, your style sheet might clash with user style sheets. To avoid this, specify always both of them, see Section 9.1 "Color Contrast" in the W3C Note "CSS Techniques for Web Content Accessibility Guidelines 1.0" or the article CSS Color Issues by the CSS Pointers Group for a discussion.

Why don't my scrollbar properties, filters, etc. validate?

The CSS Validator validates your style sheet against some profile, e.g. CSS Level 1 or CSS Level 2. Some browser Vendors however extend these profiles by new properties like Microsoft did with the scrollbar-base-color or filter property or Mozilla with the -moz-opacity property. The Validator is not aware of these properties and using them makes your style sheet invalid in terms of the CSS specifications. Either get rid of those properties or live with the fact, that your style sheets don't validate. You cannot have both.

Why is it URI and not URL?

URI stands for Uniform Resource Identifiers, URLs are a subset of URIs, please see Naming and Addressing: URIs, URLs, ... and URIs, URLs, and URNs: Clarifications and Recommendations 1.0 for details.

Where can I download the Validator?

Philippe Le Hegaret announced the availability of the current Validator in May 2001. It is available at http://www.w3.org/2001/05/05-19-cssvalidator.zip. Philippe notes:

Don't download it if you're not willing to spend time to compile it. Makefile are deprecated, no configure script and other helpful stuffs. javac **/*java must work. You'll need sax and xerces to compile it. Some of these sources are 4 years old and were also used for testing (XML/CSS format, SVG, ATSC, CSS3, ...). Well, Sitschje managed to understand them so I guess it's not so bad.

Where can I find the Valid CSS logo?

For example at http://www.w3.org/Icons/, i.e. the GIF image and the PNG image. Please refer to W3C Logo and Icon Usage for more Icons and usage details.

Author: Björn Höhrmann <bjoern@hoehrmann.de>.

This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.