Inheritance in XML

Paul Prescod papresco at
Mon Apr 20 17:26:54 BST 1998

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:


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


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  -

"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 at
Archived as:
To (un)subscribe, mailto:majordomo at the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list