I have an attribute that I'd like to have a range of values as it's data type. By which I don't mean: a number between x and y, but more like x-y
For example <myelement myattribute="7-10" /> or <myelement myattribute="14-240" />
I'm guessing I might have to use a regular expression for this, but I was wondering if there was a simpler way that already exists?
Is there a way to specify a range as a data type
-
- Posts: 9
- Joined: Wed Apr 11, 2018 4:43 pm
Re: Is there a way to specify a range as a data type
Hello,
As far as I know the only way to impose this restriction in XSD is to use a "pattern" facet.
Best Regards,
Octavian
As far as I know the only way to impose this restriction in XSD is to use a "pattern" facet.
Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 9
- Joined: Wed Apr 11, 2018 4:43 pm
Re: Is there a way to specify a range as a data type
Thanks. In case anyone is googling this in future and finds this thread - I've gone with:
Code: Select all
<xs:pattern value="[123456789]\d*-[123456789]\d*"/>