jQuery in Action, 3rd edition
The moose likes XML and Related Technologies and the fly likes xs:enumeration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xs:enumeration" Watch "xs:enumeration" New topic


Blikkies Marais
Ranch Hand

Joined: Jun 12, 2003
Posts: 50
Hi, I have a xsd schema, in it I have the following:
<xs:restriction base="xs:string">
<xs:enumeration value="xr_ht_select"/>
<xs:enumeration value="xr_ht_text"/>
<xs:enumeration value="xr_ht_radio"/>
<xs:enumeration value="xr_ht_checkbox"/>
<xs:enumeration value="xr_ht_input"/>
<xs:enumeration value="xr_ht_password"/>
<xs:enumeration value="xr_ht_textarea"/>
<xs:enumeration value="xr_ht_mailto"/>
This means that in the xml file, you have a choice of only the above listed values for the attribute. This also give you a drop down of these values in some xml editors (eg. xml spy).
However, I would like to keep this drop down functionality, but remove the "restriction" of only those values. I.e. do not give a validation error if a values other than the above listed ones are enetered.
Is the another type other than "xs:restriction" with "xs:enumeration"?
Ashish Pagare
Ranch Hand

Joined: Oct 14, 2003
Posts: 101
Add <xs:enumeration value=""/> to your enumeration list. This is a round about way to achieve what you want. With this you can specify any value for this element.
Perhaps some one else will have a nicer solution.
[ December 19, 2003: Message edited by: Ashish Pagare ]
Blikkies Marais
Ranch Hand

Joined: Jun 12, 2003
Posts: 50
Thanks for the quick response, but unfortunaly this does not solve my problem.
Adding "<xs:enumeration value=""/>" only allows blank attributes to pass validation. I am looking to be able to type free test into the attribute, but still have the drop down list (that some xml editors offer) of the values listed above.
Any Ideas?
I agree. Here's the link: http://aspose.com/file-tools
subject: xs:enumeration
It's not a secret anymore!