Let's say I am dealing with an xsd:simpleType that is a string, needs to be of a certain character set and of a specific maximum length, similar to the below code:
<xsd:simpleType name="MyType">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[0-9]" />
<xsd:maxLength value="36" />
</xsd:restriction>
</xsd:simpleType>
So my xsd type will be a string of only digits and maximum of 36 characters. My question is whether the xsd:pattern and xsd:maxLength (or any other similar tag like minLength) can work together. My intuition is no; either pattern or length-based xsd elements only in the xsd:restriction. Therefore, I would have to add the max length restriction into the pattern.
Please note that I did test this out by unmarshalling an xml on Java and the validation failed. Regardless, what I am looking for is information as two how and whether pattern and maxLength can work together.