OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Namespace declaration versus attribute

[ Lists Home | Date Index | Thread Index ]

At 11:57 AM -0400 8/20/02, Amelia A Lewis wrote:
>Totay.  Lessee if I can present this any better.
>
>Given the following DTD:
>
><!ELEMENT root( #PCDATA)>
>
>and given XML 1.0, pre-Namespaces processing, the following instance is
>DTD-invalid:
>
><root xmlns="scheme://auth/path">text</root>
>
>This is because the DTD does not include an xmlns attribute in the root
>element content model.
>
>The following example, under the same processing conditions is also 
>DTD-invalid:
>
><ns:root xmlns:ns="scheme://auth/path">text</ns:root>
>
>In this case, the "ns:root" element is not recognized.
>
>Add namespace-awareness to the processor, and both examples are now
>DTD-valid.

Buzz! Wrong answer. Both instances are still DTD invalid. This is a 
common confusion about namespaces. They do not in any way change the 
definition of validity. The algorithms used to validate an XML 
document do not need to be adjusted in a namespace aware environment. 
Some versions of some parsers have gotten this wrong. Some versions 
of Xerces, in particular, like to ignore namespace declaration 
attributes when validating.

>It follows that the namespaces recommendation either changes the
>content model of every element, permitting the xmlns attribute and any
>attribute in the namespace bound to the prefix xmlns (which is different
>than the namespace bound by the xmlns attribute).  Or namespace declarations
>are not attributes.

False premise, therefore the syllogism fails.

>I cannot give an equivalent example of instances that are schema-invalid,
>because in order to check schema-validity, a processor must be namespace
>aware.  However, the following fragment is at least redundant, and possibly
>in error:

Schemas are namespace aware (unlike DTDs) and do validate against 
local names and namespace URIs. However, nothing in schemas changes 
the definitions of XML 1.0.

>Or, in sum, namespace "attributes" are not (and should not be) declared, but
>their presence does not invalidate a content model that fails to explicitly
>include them.

In schemas this is true. In DTDs this is false.
-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|          XML in a  Nutshell, 2nd Edition (O'Reilly, 2002)          |
|              http://www.cafeconleche.org/books/xian2/              |
|  http://www.amazon.com/exec/obidos/ISBN%3D0596002920/cafeaulaitA/  |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |
+----------------------------------+---------------------------------+




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS