question as in the subject: Is it valid to define an element nested in element of the same name in XSD? As an example, is the following snippet correct? \[code\]<xs:element name="TypeOfAction" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element name="TypeOfAction" minOccurs="0"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="code" type="xs:string"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType></xs:element>\[/code\]If so, how do you make xjc to properly generate classes for that? I got compilation errors like static class TypeOfAction is already defined (basically I would get two nested static classes of the same name generated).