Inheritance in XML (was Re: Problems parsing XML)
matthew at praxis.cz
Fri Apr 17 12:15:16 BST 1998
I can't resist jumping in at this point, since it reminds me of some
thoughts I had about a topic which was being discussed a couple of weeks
ago: inheritance in XML. Unfortunately I seem to have managed to lose the
original mails (hint: never remove anything from the mail server if you're
not at your primary machine), but the gist was that object-oriented
approaches to inheritance are not applicable to XML because XML, unlike OO
languages, models only data and not behavior. This led into a very
interesting and apt discussion of the difference between inheritance (i.e.
of behavior) and subtyping (e.g. of interfaces).
To say that OO techniques only apply to behavior is an oversimplication.
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
Eliot Kimber indicated some scepticism as to whether OO techniques have
really lived up to their hype. In terms of a controlled environment, they
have. Any C programmer who has moved onto C++ will attest that OO features
make it far easier to write extensible and maintainable code. On the other
hand, the promise that this would lead to interchangeable components that
could be used anywhere has clearly been a flop. Why? For exactly the reason
Tim mentioned in his mail: interoperable APIs never work. You can't
interface with code and expect this interface to apply to any environment
other than the one it was specifically designed for. This is the case
whatever technology you are using (DLLs, Java, JavaBeans, Smalltalk, COM,
CORBA, etc.). Hence XML.
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. This is as important as, say, linking facilities, and
is certainly orthogonal to the current namespace proposal.
I have been giving quite a lot of thought to how inheritance (I don't really
think sub-typing is the right term) could be implemented for XML. I'll have
to write up the details in a seperate document, as this mail is getting
pretty long. In essence:
1) HyTime provides an extremely valuable and rich basis for this work, just
as it has for XML-Link. However, the relevant aspects need to be extracted
and presented in a more easily digestible form. Also, HyTime attempts to
implement inheritance (of element content) without extending the DTD syntax.
This decision should at least be reevaluated in the context of XML.
2) OO languages provide extensive facilities for inheritance of data members
(quite independently of methods), and these concepts would also be very
valuable in this context.
3) Additional thought must be given to adapting the content model of
existing element types in a base DTD without having to write out a whole new
content model. This is pretty scary, but I imagine it would be possible to
define primitives saying things like:
a) certain new element types can be inserted in front of the existing
b) certain new element types can be appended at the end of the existing
c) certain new element types can be inserted at a given location in the
existing content model.
I'd be really interested in reading others thoughts on this matter.
From: Tim Bray <tbray at textuality.com>
To: xml-dev at ic.ac.uk <xml-dev at ic.ac.uk>
Date: Friday, April 17, 1998 6:07 AM
Subject: Re: Problems parsing XML
>At 10:35 PM 14/04/98 -0500, len bullard wrote:
>>> [Chris Maden <crism at ora.com>:]
>>> > One fundamental flaw in _XML Complete_ is Holzner's apparent belief
>>> > that you must write Java code in order to do anything useful with
>>> > XML.
>>Markup doesn't care. That's the beauty of it. :-
>Yes! What he said. As a result of having been a programmer since
>A.D. 1979, my faith in interoperable APIs is torn and shredded.
>But I think that interoperable syntax is usefully achievable.
>Hence, XML. -T.
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;
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev