W3C home > Mailing lists > Public > xml-names-editor@w3.org > February 2003

Re: comment on namespaces and DTDs

From: Richard Tobin <richard@cogsci.ed.ac.uk>
Date: Mon, 24 Feb 2003 14:39:54 GMT
Message-Id: <200302241439.OAA25877@mcpherson.cogsci.ed.ac.uk>
To: Paul.V.Biron@KP.ORG
Cc: xml-names-editor@w3.org

I just read your comments on the namespaces 1.1 draft.

This isn't a formal response to them, just an attempt to clarify before
the core WG discusses the comments at next week's meeting.

> First of all, the term "namespace-aware" is not defined.

True, but this is just a "Note that" paragraph.  I think formally
defining it would be disproportionate.

> 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)

Just to be clear: when we say "no mechanism is provided for binding or
defaulting namespaces within a DTD", "defaulting" means using the
default namespace, not defaulting attribute values.

The point is that things like

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

only affect the namespace of an "element" element in the instance,
they don't do anything to the declarations in the DTD.  In particular,
it doesn't make the declaration of element apply to all "element"
elements in the urn:some:uri namespace regardless of their prefix; it
only applies to the ones whose XML 1.0 name is "element".

To put it another way,

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

is NOT a namespace declaration.  It just causes "element" elements in
the instance to acquire a namespace declaration when attribute
defaulting is done.  It's only interpreted in the instance.

Anyway, I think we just need to clarify the wording.


Your examples:

<!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>

That one is both valid and namespace-valid.

<!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>

That one is valid, but namespace-invalid.

As you say, DTD validation compares prefixes - or rather uninterpreted
names - not (namespace name, local name) pairs.  The following
document is invalid even when using a namespace-aware processor,
because the DTD declares only bar, not p:bar.

<!DOCTYPE foo [
<!ELEMENT foo ANY>
<!ATTLIST foo xmlns CDATA #IMPLIED
              xmlns:p CDATA #IMPLIED>
<!ELEMENT bar EMPTY>
]>
<foo xmlns="urn:some:uri" xmlns:p="urn:some:uri">
 <p:bar/>
</foo>



I hadn't looked at the DOM Validation spec before.  I'm a bit baffled
by the definition you quote:

 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.

It seems to be a method on Documents that takes a namespace name as
an argument, so why does it say "belonging to the element's namespace".
What element's namespace?  Surely it should say "belonging to the
namespace given as a parameter"?

 Parameters
  namespaceURI of type DOMString
  namespaceURI of namespace. For DTDs, this is NULL.

I would have expected from this that in the DTD case, your example

  doc.getDefinedElementTypes ("urn:some:uri")

would be an error, since the namespaceURI parameter is not NULL as
required.  If you called doc.getDefinedElementTypes(NULL), I would
expect to get back (element, child).

-- Richard
Received on Monday, 24 February 2003 09:39:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:59:43 GMT