OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: Inheritance in XML

[ Lists Home | Date Index | Thread Index ]
  • From: Paul Prescod <papresco@technologist.com>
  • To: xml-dev@ic.ac.uk
  • Date: Mon, 20 Apr 1998 11:24:15 -0400

Robin Cover wrote:
> 
> OODB           SGML/XML Markup
> 
> class defn     element declaration
> class name     element type
> object         element
> attribute      attribute
> 
> If we accept this crude analogy, and accept SGML's notion of an
> "attribute" as a name-value pair, then the hope of creating subclasses
> through SGML/XML element declarations appears slim.  

I don't think tha the problem is with SGML/XML element type
declarations. I think that it is with trying to import too literally OO
features. The most important thing about an object is its set of
"methods" or "slots". These define its interface. The most important
thing about an XML element is its content model, or, more generally, the
language it defines (content model+attributes).

But languages and methods are very different. If we made XML's
attributes "richer", we could have attributes that are more like
properties. But the content model problem would remain unless we removed
content models altogether.

OOP works because they figured out a smart way of defining interfaces
(sets of methods) and sub-interfaces (subsets of methods). We must do
the same for languages. 

The problem is easy if we strictly require subtypes to define
sublanguages (i.e. merely restricted content models). That would
occasionally be useful:

<!ELEMENT EMPH (#PCDATA|IMG)>
<!ELEMENT STRONG (#PCDATA|IMG) ISA EMPH>
<!ELEMENT CITE (#PCDATA) ISA EMPH>

But more often we want not just a strict sublanguage, but a language
that can be *transformed into* a sublanguage. For example:

<!ELEMENT FIGURE (CAPTION, OBJECT)>
<!ELEMENT APPLET (CAPTION, JAVACODE) 
	ISA FIGURE( CAPTION=CAPTION, OBJECT=JAVACODE )>

To me, this is much more interesting and useful, but also harder to
figure out, especially when we use the full power of content models.

 Paul Prescod  - http://itrc.uwaterloo.ca/~papresco

"Journalism is good if you follow the rules. Don't allow the human 
rights groups to spoil your profession" 
    - Col. Godwin Ugbo of the  Nigerian military dictatorship

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS