Re: Content-type for XHTML (was: XMLC, setEnableXTHMLCompatibilty)
Jacob Kjome <[email protected]> Wed, 08 Oct 2003 11:38:01 -0500
| Newsgroups | gmane.comp.java.enhydra.xmlc |
|---|---|
| Message-ID | <[email protected]> |
Hi David,
At 09:15 AM 10/8/2003 -0500, you wrote:
>>Should really need the Namespace declaration? Shouldn't the Content-type
>>(not
>>to mention the document type) be adequate? (My question here is, "isnt this
>>a minor Mozilla bug? )
Ok, I think you are right here. One shouldn't have to provide the
namespace. My previous argument is incorrect. Here is the definition for
the <html> element...
<!ELEMENT html (head, body)>
<!ATTLIST
<http://www.w3.org/TR/xhtml1/dtds.html#dtdentry_xhtml1-transitional.dtd_html>html
<http://www.w3.org/TR/xhtml1/dtds.html#dtdentry_xhtml1-transitional.dtd_i18n>%i18n;
id ID #IMPLIED
xmlns
<http://www.w3.org/TR/xhtml1/dtds.html#dtdentry_xhtml1-transitional.dtd_URI>%URI;
#FIXED 'http://www.w3.org/1999/xhtml'
>
Notice the "xmlns" attribute is "#FIXED". That means that, if provided,
the value must be exactly that specified by the DTD
('http://www.w3.org/1999/xhtml'). However (and this is the kicker), if
*not* provided, the DTD sets the default namespace for you.
An article I found on the developerworks site was very helpful in
clarifying this:
http://www-106.ibm.com/developerworks/xml/library/x-tipfxatt.html
Note the caveats mentioned there about using a default namespace, but I
don't think that will affect most people.
In essence, you are right that Mozilla should be picking up the default
namespace when parsing an XHTML document (with the XML parser) which
provides the XHTML dtd, without requiring it to be specified in the <html>
element. Given this buggy behavior, you should probably provide it anyway
and the overall solution that I documented in my previous email still stands.
Jake