Namespaces Not Necessarily Unrepentant Evil

james anderson James.Anderson at mecomnet.de
Fri Aug 28 18:43:56 BST 1998


David Rosenborg wrote:

> One problem I see with names in XML is that there is really only
> type names (except for attribute names).
> 
> In programming languages you normally have at least both variable
> names and type names. Just type names work if the data you are
> dealing with is sequential in some sense. This is often
> the case in traditional documents. For example, a document may
> consist of a sequence of chapters which in turn consist of
> sequences of paragraphs. In this case, just type is enough.
> There would be little meaning in naming the individual paragraphs.
> This is analogous to arrays in programming languages.
> 
> The problem arises when you start to use XML for other
> kind of data (and more-than-basic documents too, for that matter).

Yes, the "name identity" problem has, for reasons which I've yet to
comprehend, been declared to pertain to attribute and element names only. That
one cannot qualify entity and notation names <em>would appear</em> to be just
as much of a problem in compound documents as that which arises with
attributes and element, but I am advised that practice does not bear this out.
In any event, the issue has little bearing on the question which you raise,
since elements can be identified independent of both position and type by
virtue of attribute values. The standard ID attributes are specified to have a
scope of and uniqueness within a document, which property, in combination with
the qualification on the attribute name, ensures that an unambiguous
interpretation is possible.

> What I would like to express is: (in pseudo language/syntax)
> 
> In Namespace MyNS declare
> 
>   abstract ElementType Color;
> 
>   ElementType TextPad as
>     foreground of type Color;
>     background of type Color;
> 
>     (TextItem*)
>   end
> 
>  ...
> end
> 
> ...
> Any thoughts?

yes;

You are not subtyping the color elements, but instead binding them to storage
elements named "foreground" and "background". they are not subtyped, since
neither their structure nor their behaviour is modified by the relation to the
respective name.

In this situation, either of the encodings

<text-pad>
  <color purpose='foreground'><rgb red="0" green="0" blue="0"/>
   <!-- leaving open the option of additions/alternative color description -->
   </color>
  <color purpose='background'><rgb red="0" green="0" blue="0"/></color>
</text-pad>

<text-pad>
  <foreground><color><rgb red="0" green="0" blue="0"/></color></foreground>
  <background><color><rgb red="0" green="0" blue="0"/></color></background>
</text-pad>

express the relations which you describe.

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