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

Re: XML and inheritance and transformation of representations

  • From: Rick JELLIFFE <ricko@g...>
  • To: xml-dev@l...
  • Date: Thu, 13 Jul 2000 15:40:44 +0800

schematron transformation
"Tolkin, Steve" wrote:
> 
> 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"/>
 
> 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?

This data sets you up for a fall: the information you need is in the
CLASS attribute, and the generic identifier OBJECT is almost useless.
The generic identifiers are the primary (in fact, only) markup that XML
DTDs and XML Schemas use to determine the allowed content model (i.e.,
which subelements).  

In SGML terms, you have two "architectures" here: one based on OBJECT
and one based on JTextField. DTDs only let you validate the one using
element names (generic identifiers).
 
There are three approaches to this.

1) Use an architecture processor. I think Dave Megginson did something
along these lines, but I am not sure how well it works. I think you can
use SP/NSGMLS to validate architectures, but it may be too difficult to
get up to speed on how.

2) Transform the document into the architectural view  of JTextField
using XSLT. Transpose the CLASS attribute value and the value of the
GI.  Then you can make a conventional DTD or XML Schema.  There are
probably almost no constraints that cannot be checked using enough
transformation/schema pairs with a high-powered schema language with
datatyping such as XML Schemas.

3) Create a Schematron schema.   Schematron can describe constraints for
any information item, not just the generic identifer (element name).  So
you can say "An OBJECT with a CLASS attribute "Rectagle" can contain 4
OBJECTS with class attribute "intenger" or 2 OBJECTs with class
attribute "point" etc etc".
Schematron is free and open source.  
http://www.ascc.net/xml/resource/schematron/schematron.html


Rick Jelliffe

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.