Restriction in on XSD generation

Hello,
I added 2 tags to the class to generate xs:maxLength restriction.
The restriction Tag comes first and then the maxLength tag, But when I generate the XSD, the maxLength line is not inside restriction tag but outside, which makes syntax incorrect. How correctly should I assign the tag so I will get
<xs:restriction base=“string”>
<xs:maxLength value=“1”>
</xs:maxLength>
</xs:restriction>