Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to resolve xjc method name conflict?

843834Jul 20 2004 — edited Jul 20 2004
Hi! 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 17 2004
Added on Jul 20 2004
1 comment
259 views