How to resolve xjc method name conflict?
843834Jul 20 2004 — edited Jul 20 2004Hi! I'm having a problem with certain types of schema constructs and the method names in the xjc-generated classes. E.g., given the schema fragment:
<xs:element name="DocRef_type">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:integer">
<xs:attribute name="value" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="medline"/>
<xs:enumeration value="pubmed"/>
<xs:enumeration value="ncbigi"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
xjc (current release) fails on this schema, because it would generate overlapping method names: one getValue() to return the integer value, and one getValue() to return the string attribute named "value". Now, I know I can fix this by just changing 'name="value"' to 'name="somethingElse"' in the above attribute, but this breaks existing XML data we've already got that uses value="...".
Is there some way to tell xjc to use a different name mapping to resolve this conflict in the generated java class?
TIA for any tips,
- Paul