• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JAXB XJC compiling Issue

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 734
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 734
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
>[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...
 
Do not set lab on fire. Or this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic