www.webdeveloper.com
Results 1 to 12 of 12

Thread: CSS Validator says validate XML first!

  1. #1
    Join Date
    Jan 2007
    Posts
    11

    CSS Validator says validate XML first!

    I feel like I'm missing something really obvious here, but I have validated every XML doc on my site and yet when I follow the link to validate CSS I get this error every time. I am coming right off of the page that tells me I am VALID XHTML 1.0 Transitional, so I don't know how else to satisfy this requirement the CSS validator is requesting:

    Please, validate your XML document first!

    Line 1

    Column 1

    Content is not allowed in prolog.

    Anybody get this?

  2. #2
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    Post the URL please.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  3. #3
    Join Date
    Jan 2007
    Posts
    11

  4. #4
    Join Date
    Dec 2005
    Location
    American, living in Toronto, ON. CANADA
    Posts
    6,746
    You need to correct the URI: the "uniform resource identifier", which is to say, you cannot have 'whitespace' in the name of an image. That is because if you are using quotes around the image, the 'opening quotation mark' meets the 'whitepsace' and assumes that this is the end of the image, -the URI is essentially 'broken'.
    Rename the images using either a hyphen or an underscore ("-" or "_") if the name of the image is going to be two or more words.
    This might not be the cause of the problem, but it does throw a 'warning' when validated.
    I build for: Firefox and tweak for IE

  5. #5
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,322
    Perhaps it's a side-effect of the BOM?
    The Unicode Byte-Order Mark (BOM) in UTF-8 encoded files is known to cause problems for some text editors and older browsers. You may want to consider avoiding its use until it is better supported
    You might try saving the file as a plain ASCII text file instead of unicode and see if that makes any difference.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  6. #6
    Join Date
    Jan 2007
    Posts
    11

    Question

    Thanks for replies-
    I could only find one instance of whitespace and it was in the name of a dir, not an image. I changed it anyway, but the CSS Validator still won't let me in and requests I validate the XML first (which as I said before, I've already done). I XHTML validate, however as the next reply points out I do get the BOM "warning". I really don't see why this would cause a problem, since I'm not using an older browser (IE7) and the issue is the CSS Validator doesn't see me as XHTML Validated. Why does the XHTML Validator say the code is VALID, if it is not valid? I would get rid of the BOM, but I don't know how. The problem is all I have is Notepad to write these files, and Notepad adds the BOM! It provides these options on Save As: ANSI, Unicode, Unicode big endian, and UTF-8.
    I just wasn't sure what to charset to declare with the other 3 choices...

  7. #7
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    Doh!

    I've been pondering this one for days when all I needed to do was read the error message. You've some content in the prolog, the prolog being everything before the root element, "html". I'm thinking that you have one of several problems. Either the CSS parser wants to see the XML declaration, it isn't recognizing the DOCTYPE as a DOCTYPE or it doesn't like the extra newline character between the DOCTYPE and the root.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  8. #8
    Join Date
    Jan 2007
    Posts
    11
    oh yea? well double doh on you!
    and as you have no doubt discerned, i know just enough about this business to be, uh, dumbgerous.
    i did not know i even had a XML document. i thought it was HTML i was writing. actually before i looked into that, i thought those two were things were interchangeable. anyway, that's enough honesty for one day-
    your post sounds like the crux to me, and although i don't completely understand everything that you said, you've given me plenty there to be able to figure it out: so i thank-you.

  9. #9
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    You really, really need to stop using XHTML. Stick with HTML. Use the HTML 4.01 Strict DTD and get rid of those trailling "/" things in empty tags and then re-validate everything.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  10. #10
    Join Date
    Jan 2007
    Posts
    11
    but that confuses me... even though i've been at this for oh about 10 minutes and so that's a short trip ( )...
    i have but one book that i've used to learn most of what i know (which is very little), and it says xhtml is stronger, more flexible & more likely to be supported in the future... that's why i went there... not a good thing?

  11. #11
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    Destroy that book. If it's so completely wrong about this that I fear to imagine what other harm it is doing.

    Once the book is destroyed you might consider an exorcism.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  12. #12
    Join Date
    Jan 2007
    Posts
    11
    I'm gonna keep the book, it does discuss reasons for the alternate opinions, but it gives plenty of backup for its recommendations...
    I just wanted to close out this thread with the info that the problem was indeed the byte order mark. After spending considerable time trying to understand why NotePad, WordPad and WordPerfect (all I had) were not capable of saving UTF-8 without the BOM, I downloaded jedit and am much the happier for it. I just cut and pasted my index.html into jedit and saved it, then uploaded it, and now the CSS validator works right off. So, the WARNING of BOM detected produced by the (X)HTML Validator was the hint that the CSS Validator wasn't gonna dance... even though it was "valid" XHTML coding.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles