aspose file tools*
The moose likes XML and Related Technologies and the fly likes JAXB XJC compiling Issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "JAXB XJC compiling Issue" Watch "JAXB XJC compiling Issue" New topic
Author

JAXB XJC compiling Issue

Vikram Veeravelu
Greenhorn

Joined: Jan 08, 2012
Posts: 2
I am using JAXB 2.0 to generate POJO .
I have the following XSD
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="test">
<xs:complexType>
<xs:attribute name="system" type="xs:string"/>
<xs:attribute name="dim" type="xs:integer"/>
</xs:complexType>
</xs:element>
<xs:element name="test1" type="xs:string"/>
<xs:element name="test2" type="xs:string"/>
<xs:element name="scoring_guide" type="embedded_scoring_guide_type"/>
<xs:complexType name="embedded_scoring_guide_type">
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="test"/>
<xs:element ref="test1"/>
</xs:choice>
<xs:choice>
<xs:element ref="test2" maxOccurs="unbounded"/>
</xs:choice>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="test"/>
<xs:element ref="test1"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:schema>

When I am trying to generate POJO out of the above Schema .I am getting the below error
Gennerating jaxb objects for C:\WORKAREA\JAXB\SubSeqenceElementCall\schema\SubSequentElementCall.xsd Using XJC generator...
parsing a schema...
[ERROR] Property "TestOrTest1" is already defined. Use <jaxb:property> to resolve this conflict.
line 14 of file:/C:/WORKAREA/JAXB/SubSeqenceElementCall/schema/SubSequentElementCall.xsd

[ERROR] The following location is relevant to the above error
line 21 of file:/C:/WORKAREA/JAXB/SubSeqenceElementCall/schema/SubSequentElementCall.xsd

[ERROR] Element "test1" shows up in more than one properties.
line 21 of file:/C:/WORKAREA/JAXB/SubSeqenceElementCall/schema/SubSequentElementCall.xsd

[ERROR] The following location is relevant to the above error
line 14 of file:/C:/WORKAREA/JAXB/SubSeqenceElementCall/schema/SubSequentElementCall.xsd

Failed to parse a schema.
Gennerating jaxb objects for C:\WORKAREA\JAXB\SubSeqenceElementCall\schema\SubSequentElementCall.xsd Completed!

Please help on the above issue.

Thanks
Vikram
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 535
    
    3
The first and the third choice groups would compile with the generated property name collided if we let the default naming mechanism operating. The suggested action to take in the message is exactly what you have to take to resolve the conflict. This is the core custom binding part for the purpose.

It will then generate properties of protected List<Object> for the pupose named Testchoice1 and Testchoice3. You can establish the names you like better, of course.
Vikram Veeravelu
Greenhorn

Joined: Jan 08, 2012
Posts: 2
Thanks for the reply.After applying the custom binding ,I am still getting the below error.


Could you please help me on this.

Thanks
Vikram
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 535
    
    3
>[ERROR] Element "test" shows up in more than one properties.
That can't happen with the xsd shown (no more no less), unless... Unless you create more name conflict on the way of customization?! "Test" is not the only particle available to you for naming...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAXB XJC compiling Issue