Re: Inheritance in XML

Ron Bourret (rbourret@dvs1.informatik.tu-darmstadt.de)
Mon, 27 Apr 1998 14:51:48 +0200


My thanks to everyone who participated in the semantics and XML-DEVIL =
posts for=20
a most amusing Monday morning. I get the list in digest form, so you =
can only=20
imagine the cumulative impact of reading this all at once...

I'd like to answer a question Matthew Gertner asked last Monday. (That =
was a=20
week ago. Remember? Before Noam Chomsky and the lawyers from Chicago?)

> Having given this some more thought, I don't see any practical way to =
insert
> new content in the middle of an existing content model. Maybe someone
> cleverer than I has an idea about how this might be done (and whether =
it is
> really useful). In the meantime, one useful approach might be to at =
least
> enable new content to be added at the beginning of the base content =
model by
> adding a #BASECONTENT keyword which is replaced by the base content =
model in
> the derived element type description:

Extending an existing DTD by inserting new content in the middle is =
definitely=20
useful. Imagine that I had a simple DTD for books:

<!ELEMENT Book (TitlePage, TOC, Chapter+)>
...

Now I want to add a list of figures after the table of contents and =
before the=20
chapters:

<!ELEMENT Book (TitlePage, TOC, FigureList, Chapter+)>

I can't easily do this without insertion.

Note that a very simple way to do this is for my derived document to =
simply=20
redefine the Book element. In effect, the two (or more) DTDs are simply =
merged=20
before normal processing, with the precedence for multiply defined terms =
going=20
to definitions in the derived document. Although this probably doesn't =
satisfy=20
a lot of requirements for polymorphism, etc., it does satisfy Matthew's=20
requirement in a later post, which I agree would greatly increase the=20
applicability of XML.

> All I want is to be able to do is scoot over to the DTD repository =
site,
> check for a standard DTD for invoices, grab it, extend it with the two =
or
> three extra attributes and/or contained element types that I need and =
use it,
> while still being able to use any tools that are designed to work with =
the
> original invoice DTD. I truly believe that this is where XML will =
really
> start to fulfill its promise.

It is easy to imagine a large number of simple, useful DTDs: date/time,=20
measurement, word definitions, travel itineraries, bibliographies, etc.

Has anybody working on the namespaces spec considered this sort of=20
functionality? It strikes me as being very close.

-- Ron Bourret