xjc: XML Validation issue



I am trying to generate java code using xjc.


My xsd is having following element



<xs:element name="DataRate">
<xs:attribute name="Limit" type="xs:decimal" use="optional" />
</xs:element>


and xjc is complaining with



[ERROR] s4s-elt-must-match.1: The content of 'DataRate' must match (annotation?, (simpleType | complexType)?, (unique | key | keyref)*)). A problem was found starting at: attribute.


After little investigation, i got to know that the attribute element is not wrapped with complexType and hence xjc is complaining. If I modify the xsd as



<xs:element name="DataRate">
<xs:complexType>
<xs:attribute name="Limit" type="xs:decimal" use="optional" />
</xs:complexType>
</xs:element>


it is working fine. But, as the xsd I am getting from 3rd party, I want to avoid the modification.


Is there any other way to do that?


No comments:

Post a Comment