[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Namespace declaration versus attribute


invalid namespace declaration
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@m... | 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/    |
+----------------------------------+---------------------------------+

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.