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

RE: XML Schema: enumeration 'value' subtyping

  • From: "Arnold, Curt" <Curt.Arnold@h...>
  • To: "'Stefan.Keller@l...'" <Stefan.Keller@l...>
  • Date: Fri, 28 Jul 2000 13:20:06 -0600

xml schema enumeration
You can accomplish the same type of refinement of information in XML
with XML schemas, however you would do it with elements (aka complexType) 
instead of an "subtyping" an attribute value (aka simpleType).

Something like:

<xsd:schema targetNamespace="http://ly.admin.ch/Namespaces/Federal" xmlns:xsd="...">
	<xsd:complexType name="Landcover"/>
		<!--  this element refines the landcover  -->
		<xsd:element ref="LandcoverType" minOccurs="0"/>
	</xsd:complexType>
	<xsd:element name="Landcover" type="Landcover"/>
	<xsd:element name="LandcoverType" abstract="true" type="urType"/>
	<xsd:element name="building" 
		content="eltOnly" 
		equivClass="LandcoverType">
		<!--  placeholder for further refinement  -->
		<xsd:element ref="BuildingType" minOccurs="0"/>
	</xsd:element>
	<element name="BuildingType" abstract="true" type="urType"/>
	....
</xsd:schema>

Your "federal" instance document could look like:

<Plot xmlns="http://ly.admin.ch/Namespaces/Federal">
	<Landcover>
		<building/>
	</Landcover>
</Plot>

The canton can create another schema that adds additional members to the
LandcoverType or BuildingType.

<xsd:schema targetNamespace="http://mycanton.admin.ch/Namespaces/MyCanton"
	xmlns:federal="http://ly.admin.ch/Namespaces/Federal">
	<xsd:import namespace="http://ly.admin.ch/Namespaces/Federal" 
		schemaLocation="..."/>

	<xsd:element name="BuildingSize" abstract="true" type="urType"/>
	<xsd:element name="private" equivClass="federal:BuildingType">
		<xsd:complexType>
			<xsd:element ref="BuildingSize" minOccurs="0"/>
		<xsd:complexType>
	<xsd:element>
	<xsd:element name="public" equivClass="federal:BuildingType"/>
</xsd:schema>

Now an instance that wants to take advantage of the canton information
would look something like:

<Plot xmlns="http://ly.admin.ch/Namespaces/Federal">
	xmlns:canton="http://mycanton.admin.ch/Namespaces/MyCanton">
	<Landcover>
		<building>
			<canton:private/>
		</building>
	</Landcover>
</Plot>

This could be extended down to the county level.

There are a few differences between this model and the approach 
that you outlined.

1. Opportunities for extension must be specified in the base document.

2. Applications that are only aware of the federal level don't get
confused by canton or county specific information they don't recognize.


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.