- From: Simon Cox <Simon.Cox@dem.csiro.au>
- Date: Thu, 22 Feb 2001 10:46:22 +0800
- To: "Henry S. Thompson" <ht@cogsci.ed.ac.uk>
- CC: xmlschema-dev@w3.org
"Henry S. Thompson" wrote:
>
> Simon Cox <Simon.Cox@dem.csiro.au> writes:
>
> > 1. I want to define an abstract element <_Observation>,
> > whose substitutionGroup includes elements such as
> > <Quantity> which has simple content of type xsd:double
> > <Value> with simple content of type xsd:string
> > <Count> with simple content of type xsd:nonNegativeInteger
> >
> > e.g. Can I define an abstract base type with no content
> > (complexType?), or of "anyType" (can this be a simpleType?),
> > and then "restrict" the base to the various simpleTypes?
>
> Yes.
How?
Here's my current workarounds, with comments.
It leads to me having to use <xsd:group ref="qf:Observation"> in content models,
where I prefer to see <xsd:element ref="qf:_Observation">.
<!-- Generic (abstract) Complex Observation -->
<xsd:element name="_ComplexObservation" type="qf:AbstractComplexObservationType"
abstract="true"/>
<!-- AbstractComplexObservationType is an empty complex type
-- to which specific content models can be inserted by extension -->
<!-- Generic Scalar Observations -->
<xsd:element name="Count" type="xsd:nonNegativeInteger"/>
<xsd:element name="Quantity" type="qf:quant"/>
<xsd:element name="Value" type="xsd:string"/>
<xsd:group name="ScalarObservation">
<xsd:choice>
<xsd:element ref="qf:Value"/>
<xsd:element ref="qf:Count"/>
<xsd:element ref="qf:Quantity"/>
</xsd:choice>
</xsd:group>
<!-- not really happy about using a choice-group here,
-- would prefer an abstract element and substitution group,
-- but simpleType elements cannot be declared "abstract"
-- and also I can't figure out how to derive specific
-- simple types by restriction from anyType -->
<!-- The general Observation group -->
<xsd:group name="Observation">
<xsd:choice>
<xsd:element ref="qf:_ComplexObservation"/>
<xsd:group ref="qf:ScalarObservation"/>
</xsd:choice>
</xsd:group>
<!-- not really happy about using a choice-group here,
-- would prefer an abstract element and substitution group,
-- but can't figure out how to derive both simple and complex types from anyType -->
[Is this the right list for this kind of inquiry?]
--
Simon.Cox@dem.csiro.au CSIRO Exploration & Mining
T:+61(8) 9284 8443 F:+61(8) 9389 1906 M:0403 302 672
http://www.ned.dem.csiro.au/research/visualisation/
Received on Wednesday, 21 February 2001 21:46:47 UTC