Friday, October 30, 2015

Restrain how long an input is at an XSD?

As given in my enum example here, you have to explicitly make a restriction to sanity check the length of a string or an integer in an XSD. I think that would look like so:

<xs:simpleType name="Email">
   <xs:restriction base="xs:string">
      <xs:minLength value="13"/>
      <xs:maxLength value="42"/>
   </xs:restriction>
</xs:simpleType>

 
 

I'm not positive because when this came up today we became hesitant to do the work given the nasty mess we'd have to make of an otherwise terse XSD file. We're shelving the to-do for now.

No comments:

Post a Comment