Kat wrote:
I had written a huge email with a ton of questions, that I realised many really boiled down to one:

How did that one guy, 'beandizzy', pass all three tests?
http://www.goer.org/Journal/2003/Apr/index.html#results

How do I replicate those efforts?

1. The Simple Validation Test

  Validate your home page, fix every single errors and preferably fix
  all warnings, unless you have a very good reason not too.

2. The Laziness Test

  Validate all sub pages.

3. The MIME-type Test

  For all XHTML documents, the server must send the following HTTP
  header:
  Content-Type: application/xhtml+xml

The first 2 are easy. Just run them through http://validator.w3.org/ and fix what it tells you to. Although, you should be aware that the W3C validator has some XML limitations mostly related to well-formedness, but these will be picked up when you set the MIME type properly.

The third requires that you configure your server properly, and this depends on the server and/or the server side technology you're using. For static XHTML files using Apache, you can use a .htaccess file. Just create one and add the following line:

AddType application/xhtml+xml .xhtml

You can use whatever file extension you like, though if your server needs to serve both HTML and XHTML documents, it will need to be different from the one used for text/html (usually .htm or .html).

1.What is the difference between the doctype and the standard namespace? What does this namespace provide: 'html xmlns="http://www.w3.org/1999/xhtml"; xml:lan="en" ' that isn't provided by the doctype?

The DOCTYPE (short for Document Type Declaration) refers to a DTD (Document Type Definition) which describes the legal structure of the document, including element content models, attributes and their types, and their default values.

The namespace is used to associate an element with it's defined semantics. Elements in the XHTML namespace <http://www.w3.org/1999/xhtml> have their semantics defined in the XHTML recommendation or a related module. The DOCTYPE does not define semantics at all, only structure.

Although, you should be aware that the XHTML 1.x DOCTYPEs define the default value for the xmlns attribute, and so a validating parser will not inform you that you have left it out. However, it is required because not all parsers are validating parsers (no browser uses a validating parser) and so, they would not be aware that the elements were in the XHTML namespace.

2.>blockquote<An XML declaration is not required in all XML documents; however XHTML document authors are strongly encouraged to use XML declarations in all their documents. Such a declaration is required when the character encoding of the document is other than the default UTF-8 or UTF-16 and no encoding was determined by a higher-level protocol.>/blockquote<
http://www.w3.org/TR/xhtml1/

Is the XML declaration the XML prolog: ?xml version="1.0" encoding="UTF-8" ?

Yes, that is the XML Declaration, but the XML Declaration is not the same as the prolog, it is only part of it.

So if your character encoding is UTF-8, thus it is OK not to have this XML prolog?

Yes.

Or should that last 'and' have been an 'or' in the specs: Such a declaration is required when the character encoding of the document is other than the default UTF-8 or UTF-16 *OR* no encoding was determined by a higher-level protocol ?

According to the XML Recommendation, that is correct.

Thus if the server sends the character encoding as UTF-8,
then this prolog is not needed?

If the server sends any character encoding, the XML declaration is not required. However, it is strongly advised that it be included when the encoding is not UTF-8 or UTF-16, because the file itself could be saved to the local file system, where no such protocol information exists, which may then make the document non-conforming. (Note: The only exception to this rule is if you only use the US-ASCII subset of any encoding, which is also a subset of UTF-8)

--
Lachlan Hunt
http://lachy.id.au/

******************************************************
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
******************************************************

Reply via email to