- From: Biron,Paul V <Paul.V.Biron@kp.org>
- Date: Thu, 2 Jan 2003 14:17:16 -0800
- To: "'Dare Obasanjo'" <dareo@microsoft.com>, Danny Vint <dvint@mindspring.com>, xmlschema-dev@w3.org
- Cc: dvint@dvint.com
> -----Original Message----- > From: Dare Obasanjo [SMTP:dareo@microsoft.com] > Sent: Friday, December 27, 2002 12:35 PM > To: Danny Vint; xmlschema-dev@w3.org > Cc: dvint@dvint.com > Subject: RE: Enumerated List management > > > You cannot expand the value space of an enumeration using extension. This does NOT work. > You can accomplish the same thing as extension of enumerations using unions: <xs:simpleType name='myEnumBase'> <xs:restriction base='xs:token'> <xs:enumeration value='value1'/> <xs:enumeration value='value2'/> <xs:enumeration value='value3'/> <xs:enumeration value='value4'/> </xs:restriction> </xs:simpleType> <xs:simpleType name='myEnumExtension'> <xs:union memberTypes='myEnumBase'> <xs:simpleType> <xs:restriction base='xs:token'> <xs:enumeration valule='value5'/> <xs:enumeration value='value6'/> </xs:restriction> </xs:simpleType> </xs:union> </xs:simpleType> > Secondly the syntax you are using for describing schemas does not reflect the capabilities of W3C XML Schema so it is hard to agree or disagree with what you are proposing. > Definately agree. I take it that you are translating your syntax into XML Schema's transfer syntax...can you post the result of that xform? > > As for whether xsi:type only applies to elements and not attributes, the answer is Yes. > Again, agreed. pvb > -----Original Message----- > From: Danny Vint [mailto:dvint@mindspring.com] > Sent: Fri 12/27/2002 12:22 PM > To: xmlschema-dev@w3.org > Cc: dvint@dvint.com > Subject: Enumerated List management > > > > > I have a question about enumerated lists and part of the hangup/issue is > that my organization has implemented them in 2 different ways; one uses > them as attribute content and the other uses them as element content. The > difficult occurs when we want to allow the EXTENSION and RESTRICTION of our > code lists. To get around the EXTENSION issue I think we have to define > some extra types, something like this (note this isn't proper schema markup > but I think you can follow it): > > I belive the only way to may extension as well as restriction to work is > you will have to have something like this: > > <!-- ACORD Schema --> > > <simpleType name="GenderCodes" type="xsd:string"> > > <simpletype name="Genders" type="GenderCodes"> > <enum value="male"/> > <enum value="female"/> > </simpleType> > > <!-- End ACORD Schema --> > > Now if you want to extend the list you have a "base" common type to go back > to which means they are compatible types, but you are defining your own > values (all restrictions off the wider "string" type, rather than the ACORD > specific list). > > So Acme Company would do something like this for extension (Genders would > now be part of the ACME namespace when used): > > <simpletype name="Genders" type="ACORD:GenderCodes"> > <enum value="male"/> > <enum value="female"/> > <enum value='other'/> > </simpleType> > > or this for restriction: > > <simpletype name="Genders" type="ACORD:GenderCodes"> > <enum value="male"/> > </simpleType> > > or this for both: > > <simpletype name="Genders" type="ACORD:GenderCodes"> > <enum value="male"/> > <enum value='other'/> > </simpleType> > > Note that restriction would really have two ways to be defined (with either > of the two types in the ACORD schema) but I think we would want to specify > that you use the method that allows both to occur so you don't shoot > yourself in the foot later when you need to extend it as well. > > To use this I think you then need to use the xsi:type attribute to define > which list you are actually using (xsi:type="ACME:Genders". Now this simple > method I hate to say doesn't work (I believe) for attributes because of the > need for the xsi:type attribute - I believe this can only be applied to> > element content and not attributes. Is this true? > > Does anyone have an alternate solution that works and provides validation > of the values as well as allowing extension and restriction and hopefully > works nicely with code generators so they would produce the same or a > related class object. > > ..dan > --------------------------------------------------------------------------- > Danny Vint > http://www.dvint.com > > > > >
Received on Thursday, 2 January 2003 17:20:16 UTC