Enumerations for validation and display

Fraser Goffin <[email protected]>
Newsgroups gmane.comp.windows.devel.soap.general
Message-ID <[email protected]>
Enumerations for Validation and Display

Within a schema I use a enumeration facet to allow schema validation against
the set of required values for a given type. The enum defines the codified
values for this type. However, there is another requirement where the
textual description for a each of the allowable values is required and it
would be nice to be able to design a schema which could accomodate both of
these. As an example, say I have the following schema type :-

<xs:simpleType name="Size">
  <xs:restriction base="xs:string" >
    <xs:enumeration value="S" />
    <xs:enumeration value="M" />
    <xs:enumeration value="L" />
    <xs:enumeration value="XL" />
    <xs:enumeration value="XXL" />
  </xs:restriction>
</xs:simpleType>

In my web service request message a consumer uses one of the codified values
to indicate the required size.

However, say I also want to build a browser based application (perhaps
XForms) which will provide a 'drop down' list box control which displays the
descriptions for each size (Small, Medium, Large, etc..) as well as supply
the code when the form is submitted.

I would like to use my schema as the single source of codelists for both
purposes.

Can anyone help me find a workable solution ?

_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx

You can read messages from the SOAP archive, unsubscribe from SOAP, or subscribe to other
DevelopMentor lists at http://discuss.develop.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.