Re: More transparency concerning "Missing xmlns attribute for element html" or [VE][no-xmlns]

doug shults wrote:

> Can someone please explain what this means. I read and re-read the
> string below but I'm still confused.

The string below? You seem to mean the string "Missing xmlns attribute for 
element html".

It is an error message caused by the absence of an xmlns attribute for the 
element html, in a document with a document type definition that declares 
that attribute as obligatory. At the general level of XML validation, 
there's really nothing else to be said.

On the practical side, you are presumably using XHTML 1.0, which indeed 
declares the attribute as obligatory and specifies the fixed value that it 
must have:

<!ELEMENT html (head, body)>
<!ATTLIST html
  %i18n;
  id          ID             #IMPLIED
  xmlns       %URI;          #FIXED 'http://www.w3.org/1999/xhtml'
  >

The XML specification is a bit obscure in defining the meaning of #FIXED, 
but it is clearly meant to be defined as in SGML: it means that the 
attribute must be present in markup and must have the specified value.

The "but why, oh why?" question apparently arises, but the answer would be 
fairly long and complex, if it is nowhere near correct and useful.

But here's an attempt at a short answer from a specific perspective:

The only good reason for using XHTML (as opposite to HTML 4.01) is that your 
documents will be somehow processed by tools that operate on real XML (as 
opposite to tag soup consumers like web browsers) and require that XML rules 
be really obeyed. This implies that the tools may need information about 
namespaces. Namespaces are used to resolve potential conflicts between 
XML-based markup systems ("languages"): one system may use an element name 
for something and a different system for something else. In XHTML, <p> means 
a paragraph and has certain optional attributes and certain content model 
(i.e., syntax of allowed content). In FooXML, it might mean something 
completely different and may have quite different attributes and content 
model. When you feed an XHTML document into a program that works on XML 
documents, the xmlns attribute binds element and attribute names to a 
specific namespace. The program may have and use information about a 
particular namespace, or it may treat it as just another namespace.

> I tried to change the char-set
> from ASII to UTF-8, and thought this would get rid of the error.

Character encoding (or its declaration) has nothing to do with the issue.

> I just want the error to go away.

The error or the error message?

The way to make the error go away is to add the attribute 
xmlns="http://www.w3.org/1999/xhtml" into the <html> tag. Then the error 
message goes away, too.

> Is there a new xtml release from the
> w3 I need to reference?

No. There is nothing new in this area in specifications. But the validator 
did not previously report this error, though it was fixed to do so almost a 
year ago (September 2007, I think).

Yucca 

Received on Saturday, 16 August 2008 05:17:53 UTC