Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

George3 asked in Computers & InternetInternet · 1 decade ago

XML declaration above DOCTYPE?

What I mean is, should I include the line: "<?xml version="1.0" encoding="UTF-8"?>" at the very top of my web pages? Some pages are XHTML 1.0 compliant and some are valid for XHTML 1.1. Has anyone had a problem with or without this XML declaration line? Some examples I see ( http://www.w3.org/TR/xhtml1/#C_9 ) say to add the line if you can't set Content-Type on the webserver but some othere templates (like here: http://www.webstandards.org/learn/reference/templa... ) don't use it.

Update:

Based on this:

http://en.wikipedia.org/wiki/Quirks_mode#Quirks_mo...

it looks like IE 6 renders in Quirks mode if it sees an XML declaration - supposed to be fixed for IE 7?

Update 2:

I wasn't being clear enough. The key question is: "Has anyone had a problem using or not using the XML declaration line (aka XML prolog) on their website?". So I'm asking for anyone's firsthand experience with XHTML using all its "XML-ness" vs HTML.

I know the XML declaration (if I choose to use it) has to go above the DOCTYPE but besides forcing IE 6 into quirks mode, has anyone had any problems?

Actually, in light of the article "Sending XHTML as text/html Considered Harmful" http://www.hixie.ch/advocacy/xhtml I'm thinking of using X(HT)ML on the backend to generate static pages in various formats like HTML 4.01 and XHTML (WAP 2.0 for cellphones) that way I only need to maintain one source document and two (XSLT?) transformations.

3 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    The XML declaration should definitly go before the DOCTYPE, if you want a strict validation.

    If you see the page by webstandards.org, there is a validate link for XHTML,CSS at the bottom of the page. If you click the CSS link the resulting validator will report lots of errors, this means the webstandards does not follow strict standards. But they(webstandards) do give references to w3 in almost all their articles.

    Conclusion XML declaration has to go before the DOCTYPE.

    Njoy....

  • 1 decade ago

    When dealing with HTML code, there is never an absolute correct answer.

    One server will play the >loop< while another misses the >tagline<

    Welcome to the "inner circle..."

  • Anonymous
    4 years ago

    connect the css interior the header: head <link rel="stylesheet" variety="textual content cloth/css" href="/library.css"> d5d3db1765287eef77d7927cc956f5aLibraryd5d3db1765287eef77d7927cc956f5a head and do away with the <?xml-stylesheet variety="textual content cloth/css" href="/library.css"?>

Still have questions? Get your answers by asking now.