[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Inheritance in XML

  • From: Paul Prescod <papresco@t...>
  • To: xml-dev@i...
  • Date: Mon, 20 Apr 1998 11:24:15 -0400

xml element inheritance
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@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!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.