comment on namespaces and DTDs

I realize that the cutoff date for comments on the CR of Namespaces v1.1 has recently passed, but something has just been brought to my attention that I need to comment on.

A new paragraph has been added at the end of section 5 Using Qualified Names [1]:

	Note that DTD-based validation is not namespace-aware;
	no mechanism is provided for binding or defaulting namespaces
	within a DTD, and element and attribute names in declarations
	are matched literally against names in the instance. To validate
	a document that uses namespaces against a DTD, the same
	prefixes must be used in the DTD as in the instance. 

First of all, the term "namespace-aware" is not defined.  I realize that this term is in common usage (I use it all the time) but if it is to be used in the namespaces rec itself then I think it deserves a formal definition.

Secondly, the next clause "no mechanism..." directly contradicts several other statements made throughout the spec...such as the one 2 paragraphs up (which remains from v1.0) [2]

	This constraint may lead to operational difficulties
	in the case where the namespace declaration attribute
	is provided, not directly in the XML document entity,
	but via a default attribute declared in an external entity.
	Such declarations may not be read by software which
	is based on a non-validating XML processor. Many XML
	applications, presumably including namespace-sensitive
	ones, fail to require validating processors. If correct
	operation with such applications is required, namespace
	declarations must be provided either directly or via default
	attributes declared in the internal subset of the DTD. 

and the actually definition of a namespace says [3]:

	[Definition:] A namespace is declared using a family of reserved attributes.
	Such an attribute's name must either be xmlns or have xmlns: as a prefix.
	These attributes, like any other XML attributes, may be provided directly
	or by default.

This clearly says that:

	<!ATTLIST element xmlns CDATA 'urn:some:uri'>

IS a namespace declaration, and hence, a mechanism is provided for declaraing namespaces within DTDs.

I realize that the new paragraph was added to resolve a comment from the XML Query WG but at the very least I think the wording needs work.

Looking through the rest of the CR document for hints as to what "namespace-aware" might formally mean, I was lead to sections 7&8 Conformance of {Documents,Processors} [4,5].  Namespace-well-formed and namespace-valid are 2 new terms added in v1.1 relating to document conformance.  I like both of these terms and the way they are defined.  I expected to get a sense of what "namespace-aware" would mean from reading the defnition of namespace-validating in the section on processor conformance:

	[Definition: A validating XML processor that conforms to this
	specification is namespace-validating if in addition it reports
	violations of namespace validity. ] 

If I'm reading this correctly then the requirements for being a conformant processor are almost stated in the negative: if you don't report these errors then you aren't conformant.  In other words, this definition can't be used to say that a processor that only looks at prefixes is somehow not conformant.  In particular, an "updated" DTD-validating processor could be considered conformant if it correctly (according to the XML 1.1 spec) validated the following document:

<!DOCTYPE element [
	<!ELEMENT element (child)>
	<!ATTLIST element xmlns CDATA #FIXED 'urn:some:uri'>
	<!ELEMENT child EMPTY>
	<!ATTLIST child xmlns CDATA #FIXED 'urn:some:uri'>
	]>
<element>
	<child/>
</element>

and correctly (according to Namespaces 1.1) reported the following as in error:

<!DOCTYPE element [
	<!ELEMENT element (child)>
	<!ATTLIST element xmlns CDATA #FIXED 'urn:some:uri'>
	<!ELEMENT child EMPTY>
	<!ATTLIST child xmlns CDATA #FIXED 'urn:some:uri'
			id ID #IMPLIED>
	]>
<element>
	<child id='this:is:an:illegal:id'/>
</element>

Is that correct?

pvb

p.s. this comment is the result of my reviewing the DOM Level 3 Validation spec which defines a getDefinedElementTypes() [6] method on a document as:

	getDefinedElementTypes
		Returns list of all element node names belonging
		to the element's namespace. Given the names,
		nodes can be created from them; note that these
		are not nodes from the instance document, but
		rather are new nodes that could be inserted in the
		document.
		
		Parameters
			namespaceURI of type DOMString
				namespaceURI of namespace. For DTDs, this is NULL.
		Return Value
			NameList List of all element node names belonging
			to the element's namespace.

Given the text of namespaces v1.0 and v1.1 I can't find any reason why I shouldn't be able to call doc.getDefinedElementTypes ("urn:some:uri") after having loaded the namespace-valid document above and expect to get back the list "(element, child)".

[1] http://www.w3.org/TR/xml-names11/#ns-using
[2] http://www.w3.org/TR/xml-names11/#nsc-NSDeclared
[3] http://localhost/specs/w3c/xml-names.htm#ns-decl
[4] http://www.w3.org/TR/xml-names11/#Conformance
[5] http://www.w3.org/TR/xml-names11/#ProcessorConformance
[6] http://www.w3.org/TR/DOM-Level-3-Val/validation.html#VAL-Interfaces-DocumentEditVAL

Received on Wednesday, 19 February 2003 14:52:09 UTC