Inheritance in XML (was Re: Problems parsing XML)

Michael Kay M.H.Kay at eng.icl.co.uk
Fri Apr 17 12:46:17 BST 1998


Matthew Gertner:
>Some of the basic tenets of OO (encapsulation, polymorphism) are only
>applicable when behavior is modelled, but I would maintain that others
>(inheritance, identity) are equally applicable to data. The two last
>examples would both be of huge benefit to XML and are both currently
>lacking.

I agree absolutely. I have found identity and subtyping to be the two
biggest
benefits in using an object database over a relational database.

>Nevertheless, inheritance of some sort is absolutely vital if XML is to
>fulfill its promise. If we can't produce standard DTDs which can be
>extended, *without* modifying the base DTD, then many of the advantages of
>XML go out the window.

I agree that this is central. Let's leave identity out of the discussion, as
that
does, I think, fall into the XML Linking domain, and concentrate on what I
prefer to call subtyping.

There's a lot of stuff in the SGML culture that one could fall back on:
architectural forms etc, but I for one find it extremely arcane and
difficult
to relate to my own domain of object modelling and database design,
which I think is familiar to a much wider community.

I know some people will disagree, but the way I use XML, a DTD is a
schema, an element definition in a DTD is a class, a document is a
database, and an element within a document is an instance of a class.
What is missing is that we can't define one class (element type) as a
subtype of another.

Since we are only concerned with structural subtyping and not with
behaviour, I don't think it would actually be difficult to define this
concept.
The main thing that's tricky is that you can get the "is-a" the wrong way
round. If a PREFACE is-a-kind-of CHAPTER, that means you can find
anything (elements, attributes) in a PREFACE that you can find in a chapter,
and more besides. It also means you can reduce a PREFACE to a CHAPTER
by removing these extra bits. I'm not entirely sure what "removing the extra
bits" means: for example should it remove elements that cannot occur
in a CHAPTER, or should it just remove the tags that surround those
elements? This tends to show up the lack of semantics in the object
model underlying XML.

Just some thoughts...
Mike Kay, ICL


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