- From: Henry S. Thompson <ht@inf.ed.ac.uk>
- Date: Tue, 26 Jun 2007 11:48:40 +0100
- To: "Eliot Kimber" <ekimber@innodata-isogen.com>
- Cc: <xmlschema-dev@w3.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Eliot Kimber writes:
> I'm trying to understand what I can and can't do with restrictions on
> groups.
>
> What I want to do is redefine a group in order to completely replace its
> members, rather than extending its members. What I have that works
> (using OxygenXML 8.2, which I believe uses XercesJ 2.9):
Well, in principle you can't do that. W3C XML Schema defines
restriction as the elimination of _optional_ content, so getting rid
of _required_ content isn't allowed.
The motivation is to provide an invariant rather like that of
object-oriented programming languages: any valid member of a type
defined by restriction is also a valid member of the type defined by
its base.
Having said that, there's a loophole in practice (which will probably
be closed in XML Schema 1.1 -- you have been warned!), which means you
can get what you want if you do it in two steps:
Redefine2.xsd:
<xs:redefine schemaLocation="Redefine.xsd">
<xs:group name="a">
<xs:choice>
<xs:group ref="b"/>
</xs:choice>
</xs:group>
</xs:redefine>
First step extends the original by wrapping it in a choice with 'b',
second step restricts away the now-optional 'a'. Don't try this at
home, even sending this message makes me feel a bit guilty :-)
ht
- --
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
iD8DBQFGgO8JkjnJixAXWBoRAsZHAJwIxUoBaW9qs39aSVZCEzWbGo/UXwCfZ+vi
gOYbmzG+T/+UTTBv8aLD1cU=
=NfIM
-----END PGP SIGNATURE-----
Received on Tuesday, 26 June 2007 10:48:56 UTC