W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > July to September 2000

RE: XML Schema: enumeration 'value' subtyping

From: Arnold, Curt <Curt.Arnold@hyprotech.com>
Date: Fri, 28 Jul 2000 13:20:06 -0600
Message-ID: <B2C1451A181BD411B88A00E018C1C19C08A74D@THOR>
To: "'Stefan.Keller@lt.admin.ch'" <Stefan.Keller@lt.admin.ch>
Cc: "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>, "'xml-dev@xml.org'" <xml-dev@xml.org>
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.
Received on Friday, 28 July 2000 15:33:36 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:49:53 UTC