Namespaces on Attribute Names

David Megginson david at megginson.com
Tue Jul 21 19:42:30 BST 1998


james anderson writes:

 > the suggested interpretation of qualified attribute names conflates
 > two things (inheritance and namespaces). these are better left
 > distinct - at least on the conceptual level on which i understood
 > the response to have been situated.

Please take my posting as descriptive rather than prescriptive: I'm
attempting to supply an explicit conceptual framework for something
that never properly had one, but am not promoting that framework as a
good solution.

 > do i understand the suggestion correctly, to specify that the
 > presence of an attribute from a given namespace denotes a dynamic
 > subtype relation between the containing element and an element with
 > the same name as the prefix used for the namespace (the correctness
 > of applying 'LC.getRefNo' to the element).

No, I wouldn't go that far, mainly because namespaces don't have
elements or attributes; they just have names.

I'd suggest instead that the attribute from a given namespace implies
a subtype relationship between the current element and an unnamed
element type that includes the qualified attribute.

 > aren't there alternative ways to expresss that? ways which would be
 > just as expressive, though less terse, but which would also allow
 > permit other denotations and which don't lead to the such quandries
 > as the following.

(That's probably a rhetorical question.)  Yes, architectural forms
handle this situation much more smoothly by explicitly naming the
supertype, though AF's, too, have their warts in other areas.

 > if i follow your c++ example back to xml, i understand it to imply, for
 > example, that the possible declaration
 > 
 > <!ATTLIST LC LC:refno CDATA #REQUIRED >
 > 
 > applies to any element in which the attribute is present, but doesn't apply
 > when the attribute is not. !?

Namespaces and DTDs are two different kinds of things: a DTD specifies
what an author is allowed to include in a specific document, and what
defaulting for attribute values, etc., should be used.  A namespace
simply guarantees that a name is globally unique, whatever that name
happens to be used for.

 > is this the kind of thing mr murray-rust is always alluding to when
 > he mentions the "rather hairy problems of validating dtds" in the
 > presence of qualified names?

There's not really a problem from that perspective: a DTD can/will
restrict the particular uses of namespaces in a document, as in the
following example:

  <!ATTLIST doc
    LC:refno CDATA #REQUIRED
    CRTC:rating CDATA "restricted">

The problem with DTDs will come if namespaces include some kind of
defaulting or local scoping mechanism -- at that point, writing a DTD
for an XML document will become extremely difficult.


All the best,


David

-- 
David Megginson                 david at megginson.com
           http://www.megginson.com/

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list