Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » naming conflict on generating classes from xsd(how to use bindings - xjb file?)
naming conflict on generating classes from xsd [message #1016239] Tue, 05 March 2013 15:30 Go to next message
moritz du is currently offline moritz du
Messages: 98
Registered: February 2010
Member
i have to create classes from a given xsd file but i get an error:

[ERROR] Property "ServiceLocality" is already defined. Use <jaxb:property> to resolve this conflict.
line 1117 of file:/...MDInvoiceRequest_400.xsd

[ERROR] The following location is relevant to the above error
line 1164 of file:/...MDInvoiceRequest_400.xsd

the xsd is from http://www.forum-datenaustausch.ch/mdinvoicerequest_400.xsd

i read about a possible solution here:
http://stackoverflow.com/questions/4394134/jaxb-property-value-is-already-defined-use-jaxbproperty-to-resolve-this

the problem is how to get use of a xjb file in conjunction with moxy. and probably someone could say how the xjb must look in this special case.

thx in advance
Re: naming conflict on generating classes from xsd [message #1016272 is a reply to message #1016239] Tue, 05 March 2013 18:56 Go to previous messageGo to next message
Blaise Doughan is currently offline Blaise Doughan
Messages: 163
Registered: July 2009
Senior Member

Binding File (binding.xjb)

The binding file would look something like the following. Below I have renamed the property corresponding to the XML attribute.

<jxb:bindings 
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
    version="2.1">

    <jxb:bindings schemaLocation="MDInvoiceRequest_400.xsd">
            <jxb:bindings node="//xs:complexType[@name='detailType']/xs:attribute[@name='service_locality']">
                <jxb:property name="serviceLocalityAttribute"/>
            </jxb:bindings>
    </jxb:bindings>

</jxb:bindings>


Generating the Classes

To leverage the bindings file you need to use the -b flag.

jaxb-compiler.sh -b binding.xjb MDInvoiceRequest_400.xsd
Re: naming conflict on generating classes from xsd [message #1016363 is a reply to message #1016272] Wed, 06 March 2013 09:00 Go to previous message
moritz du is currently offline moritz du
Messages: 98
Registered: February 2010
Member
Thank you very much Blaise - it worked perfectly! (before i came here i read some of your xsd blogs that helped much already Smile)

are there any examples or tutorials about xjb? because i have to solve some more complex problems:
[ERROR] A class/interface with the same name "....generatedClasses.invoice.g
eneral430.request.ReferenceType" is already in use. Use a class customization to resolve this conflict.
  line 97 of file:/.../xmldsig-core-schema.xsd

[ERROR] (Relevant to above error) another "ReferenceType" is generated from here.
  line 118 of file:/.../xenc-schema.xsd

[ERROR] A class/interface with the same name "....generatedClasses.invoice.g
eneral430.request.TransformsType" is already in use. Use a class customization to resolve this conflict.
  line 109 of file:/.../xmldsig-core-schema.xsd

[ERROR] (Relevant to above error) another "TransformsType" is generated from here.
  line 64 of file:/.../xenc-schema.xsd

[ERROR] Two declarations cause a collision in the ObjectFactory class.
  line 64 of file:/.../xenc-schema.xsd

[ERROR] (Related to above error) This is the other declaration.
  line 109 of file:/.../xmldsig-core-schema.xsd

[ERROR] Two declarations cause a collision in the ObjectFactory class.
  line 118 of file:/.../xenc-schema.xsd

[ERROR] (Related to above error) This is the other declaration.
  line 97 of file:/.../xmldsig-core-schema.xsd

Failed to produce code.



this happen if i try to bind one of the four files "generalInvoiceRequest_430.xsd", "generalInvoiceRequest_440", "generalInvoiceResponse_430.xsd", "generalInvoiceResponse_430.xsd" (see attachment)
  • Attachment: xsd.7z
    (Size: 10.02KB, Downloaded 56 times)

[Updated on: Wed, 06 March 2013 09:03]

Report message to a moderator

Previous Topic:History for OneToMany relationship with JoinColumn
Next Topic:Switched to 2.4.1 - Suddenly caching of lazy relations is missing
Goto Forum:
  


Current Time: Wed Sep 17 21:56:48 GMT 2014

Powered by FUDForum. Page generated in 0.02331 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software