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: Wed, 19 Jul 2000 13:39:03 -0600
Message-ID: <B2C1451A181BD411B88A00E018C1C19C08A718@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>
I am outside observer of the XML Schema process, but I thought I might be able to help you.

Enumerations are supported on element content, not just attributes.  However, I would recommend taking a different approach to your representation.  Attributes and simple data types in XML don't
represent structure well, however elements do.

For the language/locale example, there are a lot of different mechanisms that you could use that would not involve "subtyping" enumerations.

<!--  you could use two different attributes  -->
<resource lang="EN" locale="UK"/>

<!--  you could "subtype" the language by adding attributes or elements to a language element  -->

	<english locale="UK"/>

In the vegetation localization example, you could use schema equivClass's in a base schema that could be extended by localized variants.

This could be your base schema:

<schema targetNamespace="http://lt.admin.ch/interlis/namespace/basic">
	<element name="field">
		<element name="vegetation"/>
		<element name="soil"/>

	<!--  this element cannot be used in a document,
			however importing schemas and
			donate other elements that can take its place  -->
	<element name="vegetationType" abstract="true"/>

	<element name="vegetation">
		<element name="vegetationType" minOccurs="0"

	<element name="soil">
		<element name="soilType" minOccurs="0"

You could import this schema into a regional schema and provide
additional elements that could substitute for vegetationType
and soilType.

<schema targetNamespace="http://lt.admin.ch/interlis/namespace/geneva">
	<import namespace="http://lt.admin.ch/interlis/namespace/basic"/>

	<!--  sorry, don't know any swiss grass names   -->
	<element name="fescue" equivClass="vegetationType"/>

Now you could have an instance document like:

<field xmlns="http://lt.admin.ch/interlis/namespace/basic"
Received on Wednesday, 19 July 2000 15:55:03 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:08:48 UTC