relaxng validation: specify range limit for integer

If you want to specify range limit for integers, you may be interested in the following parameters:

  • minInclusive
  • maxInclusive
  • minExclusive
  • maxExclusive

Note that ‘min’ and ‘max’ parameters do NOT exist, you must specify whether boundaries are included or not.

Example

<define name="mytype.content">
 <data type="positiveInteger">
  <param name="minInclusive">1</param>
  <param name="maxInclusive">31</param>
 </data>
</define>

With above example, validation will fail on any input that’s not an integer or that’s not within [1:31] range.

sources

Post a Comment

Your email is never published nor shared. You're allow to say what you want...

Powered by sweet Captcha