Skip to main content

Help needed with JAXB Binding

1 reply [Last post]
_DD
Offline
Joined: 2012-03-27
Points: 0

I have a situation like:

<xs:element name="A"><br />
<span class="pun">&lt;</span><span class="pln">xs</span><span class="pun">:</span><span class="pln">complexType</span><span class="pun">&gt;</span><span class="pln"><br />
    </span><span class="pun">&lt;</span><span class="pln">xs</span><span class="pun">:</span><span class="pln">choice</span><span class="pun">&gt;</span><span class="pln"><br />
      </span><span class="pun">&lt;</span><span class="pln">xs</span><span class="pun">:</span><span class="pln">sequence maxOccurs</span><span class="pun">=</span><span class="str">&quot;unbounded&quot;</span><span class="pun">&gt;</span><span class="pln"><br />
        </span><span class="pun">&lt;</span><span class="pln">xs</span><span class="pun">:</span><span class="pln">element ref</span><span class="pun">=</span><span class="str">&quot;X&quot;</span><span class="pun">/&gt;</span><span class="pln"><br />
        </span><span class="pun">&lt;</span><span class="pln">xs</span><span class="pun">:</span><span class="pln">element ref</span><span class="pun">=</span><span class="str">&quot;Y&quot;</span><span class="pun">/&gt;</span><span class="pln"><br />
      </span><span class="pun">&lt;/</span><span class="pln">xs</span><span class="pun">:</span><span class="pln">sequence</span><span class="pun">&gt;</span><span class="pln"><br />
      </span><span class="pun">&lt;</span><span class="pln">xs</span><span class="pun">:</span><span class="pln">element ref</span><span class="pun">=</span><span class="str">&quot;Y&quot;</span><span class="pun">/&gt;</span><span class="pln"><br />
    </span><span class="pun">&lt;/</span><span class="pln">xs</span><span class="pun">:</span><span class="pln">choice</span><span class="pun">&gt;</span><span class="pln"><br />
  </span><span class="pun">&lt;/</span><span class="pln">xs</span><span class="pun">:</span><span class="pln">complexType</span><span class="pun">&gt;</span>

And I am getting a parsing exception:

[ERROR] Element "{*something*}Y" shows up in more than one properties.<br />
 line *something* of file:/*something*.xsd

I am using JAXB version 2.1.13 which I cannot change.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
_DD
Offline
Joined: 2012-03-27
Points: 0

This is the workaround for the older versions:

[prettify]&lt;span class=&quot;pun&quot;&gt;&amp;lt;?&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;xml version&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; encoding&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;UTF-8&amp;quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;jaxb&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;bindings xmlns&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;jaxb&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;http://java.sun.com/xml/ns/jaxb&amp;quot;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;               xmlns&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;xs&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;               xmlns&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;xjc&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;http://java.sun.com/xml/ns/jaxb/xjc&amp;quot;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;               jaxb&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;extensionBindingPrefixes&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;xjc&amp;quot;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;               jaxb&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&amp;quot;2.0&amp;quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;jaxb&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;globalBindings&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;xjc&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;simple &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;jaxb&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;globalBindings&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&amp;gt;&lt;/span&gt;<br />[/prettify]