[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Inheritance in XML (was Re: Problems parsing XML)
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 lacking. 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 content model. b) certain new element types can be appended at the end of the existing content model. c) certain new element types can be inserted at a given location in the existing content model. d) etc. I'd be really interested in reading others thoughts on this matter. Cheers, Matthew -----Original Message----- From: Tim Bray <tbray@t...> To: xml-dev@i... <xml-dev@i...> 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@o...>:] >>> > 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@i... Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ To (un)subscribe, mailto:majordomo@i... the following message; (un)subscribe xml-dev To subscribe to the digests, mailto:majordomo@i... the following message; subscribe xml-dev-digest List coordinator, Henry Rzepa (mailto:rzepa@i...)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|