Altova Mailing List Archives>Archive Index >xmlschema-dev Archive Home >Recent entries >Thread Prev - Understanding Restrictions on Groups >Thread Next - RE: Understanding Restrictions on Groups Re: Understanding Restrictions on GroupsTo: "Eliot Kimber" <ekimber@---------------.---> Date: 6/26/2007 12:49:00 PM =2D----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 =2D -- 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@i... URL: http://www.ltg.ed.ac.uk/~ht/ [mail really from me _always_ has this .sig -- mail without it is forged sp= am] =2D----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) iD8DBQFGgO8JkjnJixAXWBoRAsZHAJwIxUoBaW9qs39aSVZCEzWbGo/UXwCfZ+vi gOYbmzG+T/+UTTBv8aLD1cU= =NfIM =2D----END PGP SIGNATURE----- From mike@s... Tue Jun 26 12:16:33 2007 Received: from maggie.w3.org ([193.51.208.68]) by | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
