This is a two part question, first I cant seem to figure out what is causing this validation error.

Line 1, Column 1: end of document in prolog

From the w3c validation online tool, the website is linked here. The second question is which doctype is the best to choose, this is still one that baffles me, whats the difference between 4.01 and 1.0 I just read this article from a list apart but it still leaves me confused as to which one is best to choose.


3 answers

This was chosen as the best answer

From the page listed here:, it is suggested that you are missing the xmlns attribute. Here is what I use for mine:

<html lang="en-US" xml:lang="en-U" xmlns="">

As for doctype, since you are aware enough and devoted enough to try to validate your pages, I would use XHTML Strict:

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

Of course, the choice can really be a personal one.

Answered over 6 years ago by kainosnous
Doug 1095

As kainosnous says, doctype choice can be a personal one, but there are some guidelines you can follow.

The two main choices are strict or transitional and XHTML or HTML.

If you are dealing with legacy content, that will inform your choices, as will the constraints of your CMS. For example, WordPress is built to always output XHTML. WP will usually comply with XHTML strict, but not always, and plugins are a crapshoot.

My recommendations: If you are starting from scratch and have full control over your code, choose strict; there is nothing in the transitional doctypes that you should be using. If you have an agreeable CMS (or you code your sites by hand), choose HTML.

[Actually, XHTML vs. HTML is an interesting, though polarizing, topic for debate. I have my opinions, others have theirs (mine are right and theirs are wrong). Long story short: It does not matter which you choose. Honestly.]

My real recommendation: dive into HTML5 and use this doctype:

<!DOCTYPE html> 

You don't have to change anything else in your code, and it's compatible with every CMS I know of. (That ALA article was written before the HTML5 doctype was available as an option.)

Answered over 6 years ago by Doug

There are some notable differences between XHTML 1.0 and HTML 4.01, however they are also very similar. The reason for this is simple: XHTML is HTML as XML, i.e. XHTML is what HTML would be if it were written as valid XML.

One of the major differences between XHTML and HTML is tag closure. In XML, the document must be "well formed," and every tag must close. That can be done like this:

<p> Some text </p>

Or like this for elements that are empty:

<img src="/img/logo.jpg" alt="Some Website Logo" />

Seeing as you've written a page that's valid for XHTML 1.0 Strict, I'm pretty sure you already know that, but that's the jist of the difference between HTML and XHTML: XHTML is HTML as XML.

In terms of Strict vs Transitional, the Transitional doctype won't punish you for omitting certain details or including deprecated attributes/tags. For example, the following is valid XHTML 1.0 Transitional, but not XHTML 1.0 Strict:

<a target="_blank" href="#">I open a new window</a>

Why? The target attribute is considered deprecated now, it is only present in the Transitional and Frameset doctype. This is probably one of the two big gripes people have with XHTML 1.0 Strict, you must use JavaScript to open new windows, but that makes sense to some degree. Much like you no longer use width, height, or valign in tables in favor of CSS, you no longer use target in links in favor of JS. Another big gotcha of Strict is that every img tag must contain an alt attribute, this is not true in Transitional.

That's all pretty straightforward and objective, though. Those are the big differences between the doctypes--which you choose to use is purely subjective: I personally use Strict in most of my documents because I don't see a reason not to use it.

Answered over 6 years ago by Zack Doherty