Here is a scaled down version of the XSD:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:simpleType name="Fixed10Digit-Type">
<xsd:restriction base="xsd:nonNegativeInteger">
<xsd:pattern value="\d{10}"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="ApprovalRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Amount" type="Fixed10Digit-Type"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
The following XML throws an exception when trying to unmarshal:
<ApprovalRequest><Amount>0000000649</Amount></ApprovalRequest>
The code produced by the Source Generator represents the field as a primitive java integers. This causes the leading zeros to be dropped. Then when the pattern validator evalutes it throws an error because the integers are not the correct length. The definition of xsd:nonNegativeInteger is "The value space of xsd:nonNegativeInteger includes the set of all the integers greater than or equal to zero, with no restriction of range. Its lexical space allows any number of insignificant leading zeros."
Is this a bug with the Source Generator? I realize changing the type to string would be a workaround, but I am processing XSDs that I do not have control over. Is there another way to get this to work?
-----------------------------------------------------------------
Steven Martin

