XML-Data: advantages over DTD syntax?

Jonathan Robie jwrobie at mindspring.com
Mon Sep 29 19:29:20 BST 1997


At 12:43 PM 9/29/97 -0400, Peter Newcomb wrote:
>[Jonathan Robie <jwrobie at mindspring.com> on Mon, 29 Sep 1997 11:49:02 -0400]
>> XML-Data adds several features that hard-core object oriented folks
>> appreciate:
>> 
>> 1. True inheritance, with semantics more similar to that of OO
>> languages than indirect mechanisms used to simulate inheritance when
>> using architectural forms. Architectural forms do not really give us
>> what OO folks call inheritance.
>
>Could you elaborate upon this distinction between architectural form
>inheritance and "true OO inheritance"?  What about XML-data makes it
>capable of supporting "truer" inheritance than architectural forms?

Let me preface this by saying that I am fairly new to both XML-data and
architectural forms, and I am perfectly willing to be shown wrong on this
statement. Let me explain some properties I see in XML-Data which I have not
yet been able to mirror completely using architectural forms. Since you know
much more about architectural forms than I do, I'll let you tell me if there
is an exact equivalent using architectural forms. In fact, this could be a
great opportunity to do a better comparison than I can do by myself.

In C++, Java, Smalltalk, and other OO languages, if I say that "a duck is an
animal", that means: (1) a duck always has all the data associated with an
animal, (2) a duck has the behavior associated with an animal (unless you
specifically say that a duck does certain things differently), and (3)
references to generic animals can also point to ducks.  To put this in
traditional OO terms, Duck inherits data, behavior, and type from Animal. In
SGML, it can't inherit behavior, but it can inherit data and type.

Microsoft's XML-Data allows me to inherit data and type in a manner very
similar to OO languages. For instance, their description of XML-Data at
their XML standards page gives the following example:

<xml:schema>
  <elementType id="animalFriends">
    <elt href="#pet" occurs="PLUS"/>
  </elementType>

  <elementType id="pet">
    <any/>
    <attribute id='name'/>
    <attribute id='owner'/>
  </elementType>

  <elementType id="cat" extends="#pet"/>
    <elt href='#kittens'/>
    <attribute id='lives' type='NMTOKEN'/>
  </elementType>

  <elementType id="dog" extends="#pet"/>
    <elt href='#puppies'/>
    <attribute id='breed'/>
  </elementType>
<xml:schema>

Now I can use this type declaration to create an animalFriends element,
which is a list of pets:

<animalFriends>
  <cat name="Fluffy" lives='9'/>
  <pet name="Diego"/>
  <dog name="Gromit" owner='Wallace' breed='mutt'/>
</animalFriends>

So the pet hrefs can point to pets, cats, or dogs.

How would I create this schema using architectural forms?

Jonathan

***************************************************************************
Jonathan Robie   jwrobie at mindspring.com  http://www.mindspring.com/~jwrobie
POET Software, 3207 Gibson Road, Durham, N.C., 27703    http://www.poet.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