- From: Simon Cox <Simon.Cox@dem.csiro.au>
- Date: Mon, 12 Feb 2001 10:34:45 +0800
- To: Holger.Juschkewitz@de.ibm.com
- CC: ht@cogsci.ed.ac.uk, xmlschema-dev@w3.org
An alternative way to accomplish what you are doing is to use
an attributeGroup instead of type derivation.
<attributeGroup name="attribute">
<attribute name="isNullable" type="boolean" use="optional"/>
<attribute name="isQueryable" type="boolean" use="optional"/>
<attribute name="isUpdatable" type="boolean" use="optional"/>
</attributeGroup>
<element name="ShipmentNo">
<complexType>
<simpleContent>
<restriction base="integer"/>
</simpleContent>
<attributeGroup ref="attribute"/>
</complexType>
</element>
I think this corresponds to the "decorator" pattern,
giving weak multiple-inheritance.
Holger.Juschkewitz@de.ibm.com wrote:
>
> Henry,
>
> sorry for bringing this up again but I had to work on something else in the
> meantime. I posted a question a few weeks ago about deriving elements
> without specifying the type of the simple content. You replied giving me
> the following suggestion:
>
> ******
> > All I'm trying to do is to derive attributes and define the simple
> > content of the derived type in the derived type. Is that possible at
> > all?!?
>
> Sure, if I've understood you correctly:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <schema xmlns="http://www.w3.org/2000/10/XMLSchema"
> xmlns:my="http://www.example.com/foo"
> targetNamespace="http://www.example.com/foo"
> version="0.4">
>
> <complexType name="attribute">
> <simpleContent>
> <extension base="anySimpleType">
> <attribute name="isNullable" type="boolean" use="optional"/>
> <attribute name="isQueryable" type="boolean" use="optional"/>
> <attribute name="isUpdatable" type="boolean" use="optional"/>
> </extension>
> </simpleContent>
> </complexType>
>
> <element name="ShipmentNo">
> <complexType>
> <simpleContent>
> <restriction base="attribute">
> <simpleType>
> <restriction base="integer"/>
> </simpleType>
> </restriction>
> </simpleContent>
> </complexType>
> </element>
>
> </schema>
>
> This is a tricky case, and there should probably be a section in the
> Primer illustrating and explaining its use.
>
> ht
> --
> 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 looks pretty much like what I'm trying to do. Thanks. But do you know
> a XML parser which supports "anySimpleType". I tried Xerces 1.3.0 which
> does not know the base type "anySimpleType". Or is this just a theoretical
> solution? If there is no parser which supports this - do you have any
> suggestion how to circumvent this problem?
>
> Thanks in advance!
> Holger
--
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 Sunday, 11 February 2001 21:35:09 UTC