[
Lists Home |
Date Index |
Thread Index
]
- From: "Tolkin, Steve" <Steve.Tolkin@fmr.com>
- To: xml-dev@lists.xml.org
- Date: Wed, 12 Jul 2000 15:34:41 -0400
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@fmr.com 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.
|