Define a regular expression the value has to match to be serialized or deserialized without any error.
DEFINE myStr STRING ATTRIBUTES(XSDString, XSDPattern="A.*Z", XMLName="MyString")
DEFINE myZipCode INTEGER ATTRIBUTES(XSDInt, XSDPattern="[0-9]{5}", XMLName="MyZipCode")
DEFINE myOtherZipCode INTEGER ATTRIBUTES(XSDInt, XSDPattern="\\d{5}", XMLName="myOtherZipCode") # regex is \d{5} see note