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

XML and inheritance and transformation of representations

  • From: "Tolkin, Steve" <Steve.Tolkin@f...>
  • To: xml-dev@l...
  • Date: Wed, 12 Jul 2000 15:34:41 -0400

xml inheritance
What kinds of "inheritance" are possible in XML, and in DTD and XML Schema?
Consider this XML, an excerpt from [1] that illustrates a general issue.

<OBJECT ID="JTextField0" CLASS="JTextField"> 
    <OBJECT PROPERTY="nextFocusableComponent" IDREF="JButton0"/> 
    <OBJECT PROPERTY="bounds" CLASS="Rectangle"> 
        <OBJECT CLASS="Integer" VALUE="30"/> 
        <OBJECT CLASS="Integer" VALUE="50"/> 
        <OBJECT CLASS="Integer" VALUE="200"/> 
        <OBJECT CLASS="Integer" VALUE="20"/> 

There is no semantic information about the role of the four integers.
I think that these correspond to two points, 
and are the x and y coordinates, and are in pixels.  
But I cannot know that withotu reading some external documentation.
Perhaps it is the coordinates of one point plus a delta x and delta y.

What techniques are available in XML to increase flexibility and clarity?  
Wearing an object oriented hat we might want to allow CLASS=rectangle 
to be have various possible implementations:
1a. As above
1b. As above, but also labelled as e.g. x1, y1, x2, y2, with either tags or
another attribute of Object e.g. ROLE="x1", or with multiple attributes
2. As one point and two distance deltas
3. As two point objects (with perhaps some constraints e.g. x1 < x2 and y1 <
y2)
4. As subtype of a polygon class, constrained to have 4 sides which form a
rectangle
etc.

What can I say in a DTD or in XML Schema to allow this kind of flexibility?


What must/can I do, in e.g. XSLT, to transform one of those other
implementations to
the original one?

Thanks,
Steve

[1] The sample XML is a small excerpt from "File Formats" at
http://java.sun.com/products/jfc/tsc/articles/persistence/fileformats.html
which is part of "Long-Term Persistence for JavaBeans" 
by Philip Milne & Kathy Walrath at 
http://java.sun.com/products/jfc/tsc/articles/persistence/index.html
They do say "This is just one possible XML format" but I have chosen a
published example to illustrate my point.
Presumably this format was chosen because these map directly into the
executable call.  For example here is the same information represented in
BeanScript format:
   let JTextField0 = Class.forName("javax.swing.JTextField").new(); 
   JTextField0.nextFocusableComponent := JButton0; 
   JTextField0.bounds := Rectangle.new(30, 50, 200, 20);  

I know why C has unlabelled parameters, but I am hoping that XML can do
better.

-- 
Steven Tolkin          steve.tolkin@f...      617-563-0516 
Fidelity Investments   82 Devonshire St. R24D    Boston MA 02109
There is nothing so practical as a good theory.  Comments are by me, 
not Fidelity Investments, its subsidiaries or affiliates.

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.