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.


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

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


Post a Comment

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