Altova Mailing List Archives


Re: NEWBIE: XML restriction query

From: BarryNL <barry@------.-->
To: NULL
Date: 2/3/2004 1:16:00 PM
Victor wrote:
> Hi, I have defined the following that limits values for <COUNTING> to
> be ONE, TWO or THREE. I want to modify it so the base isn't a string
> anymore but a long, and accept ANY long as valid, but I still want to
> accept the values ONE, TWO, or THREE. Can this be done?
> 

You could use a regular expression as the restriction, eg: 
"ONE|TWO|THREE|[1-9][0-9]+"

> Thank you
> Victor
> 
> 
> <xs:simpleType name="COUNTING">
>   <xs:restriction base="xs:string">
>      <xs:enumeration value="ONE"/> 
>      <xs:enumeration value="TWO"/>
>      <xs:enumeration value="THREE"/>
>   </xs:restriction>
> </xs:simpleType>	
> 
> 
> 
> The following would be valid against a new restriction
> 
> ONE
> TWO
> 17
> 65
> THREE
> ONE
> 765
> 861
> 12
> 67
> 
> 
> 
> The following would be invalid
> ONE
> TWO
> FOUR
> 17
> 65
> THREE
> ONE
> 765

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.