Restriction in on XSD generation

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”>