OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: Schema concepts

[ Lists Home | Date Index | Thread Index ]
  • From: ht@cogsci.ed.ac.uk (Henry S. Thompson)
  • To: XML-Dev Mailing list <xml-dev@xml.org>
  • Date: 16 Feb 2000 10:00:14 +0000

Stefan Haustein <haustein@kimo.cs.uni-dortmund.de> writes:

> I was asked to give an example why I consider
> the current XML schema syntax too complicated.
> 
> So, suppose I want to describe pictures built of 
> circles, lines and rectangles.
> 
> The first example is how I would expect 
> schema coding if I am used to OOP:
>  
>   <element name="pictureElement" abstract="true">...</element>
> 
>   <element name="picture">
>     <element minOccurs="0" maxOccurs="*" ref="pictureElement"/>
>   </element>
> 
>   <element name="circle" source="pictureElement"/>...</element>
> 
>   <element name="line" source="pictureElement"/>...</element>

You can get very close to this now.  I don't consider the difference
between the above and what follows substantive:  it's a matter of
making explicit some things which are implicit in the above:

<element name="pictureElement" abstract="true">
 <type>
   ...
 </type>
</element>

<element name="picture">
 <type>
  <element minOccurs="0" maxOccurs="*" ref="pictureElement"/>
 </type>
</element>

<element name="circle" equivClass="pictureElement"/>
 <type>
  ...
 </type>
</element>
 
<element name="line" equivClass="pictureElement"/>n
 <type>
  ...
 </type>
</element>

> The second example is what I really 
> need to do using the current XML Schema draft:
> 
>   <type name="pictureElement">...</type>
> 
>   <element name="pictureElement" type="pictureElement"/>
> 
>   <element name="picture">
>     <type>
>       <element minOccurs="0" maxOccurs="*" ref="pictureElement"/>
>     </type>
>   </element>
> 
> 
>   <type name="circle" source="pictureElement">...</type>
> 
>   <element name="circle" type="circle" equivClass="pictureElement"/>
>  
>   <type name="line" source="pictureElement">...</type>
> 
>   <element name="line" type="line" equivClass="pictureElement"/>

As exemplified above, you don't need to do this until and unless you
have a need for type reuse.  If you don't like or need the idea of
type reuse, you don't have to allow for it.

> The circle and line elements cannot just have 
> annonymous types since I may want to reuse 
> their structure. 

That's a sensible, but not required, design decision.

> Now, my question is: Is anyone able to generate a counter-example
> that justifies the current schema overhead?

Demonstrate that separating types from elements is useful?  Consider
the extended example at the beginning of Chapter 2 [1] of the current
PWD.

By separating the 'Address' type definition from the <shipTo> element
declaration, it becomes possible to add a <billTo> element to my
PurchaseOrderType definition:

  <element name="shipTo" type="po:Address"/>
  <element name="billTo" type="po:Address"/>

without pretending that they are in some way the same element: they're
not, they just share a content model and attribute set.  Similar to
the difference between structure definitions and variable type
declarations in a programming language.  I claim that declaring
elements (identifying their type) separately from defining types (what
claims on element content/attributes you may want to make) is exactly
what you want to do, and XML Schema lets you do it.  What is it you
find less then ideal about this analysis/example?

ht

[1] http://www.w3.org/TR/xmlschema-1/#concepts-types
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
************************************************
This is xml-dev, the list for XML developers.
To unsubscribe, mailto:majordomo@xml.org&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/threads.html
************************************************




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS