- From: Jeff Rafter <jeffrafter@definedweb.com>
- Date: Mon, 5 Mar 2001 08:59:13 -0800
- To: "Henry S. Thompson" <ht@cogsci.ed.ac.uk>, <seema_mehta@nzi.co.nz>
- Cc: <xmlschema-dev@w3.org>
> Can you use choice to select elements of the same name but different
type.
> In other words is the following legal:
>
> <choice>
> <element name="a" type="x"/>
> <element name="a" type="y"/>
> <element name="a" type="z"/>
> </choice>
Henry is definitely right-- a good workaround (which may not be useful in
your case) is to use the extension model built into schemas. Build a
complexType "w" which may or may not define content-- and then use that as
the base for extending "x", "y", and "z". Then your choice would look
something like:
<choice>
<element name="a" type="w"/>
</choice>
And within your instance you could specify the actual type used by
indicating xsi:type="y". Other than that there may be a couple of other
indirect approaches using substitution (?) but they aren't popping to mind
so quickly.
Good Luck,
Jeff Rafter
Received on Monday, 5 March 2001 11:59:45 UTC