Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>PROBLEM</strong></p> <p><strong>From Your XML Schema</strong></p> <p>Below is a fragment from your XML schema. The <code>itineraryType</code> contains a sequence where a <code>step</code> element can occur both inside and outside of the choice structure.</p> <pre class="lang-xml prettyprint-override"><code>&lt;xsd:complexType name="itineraryType"&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="step" type="lwis:stepType" /&gt; &lt;xsd:choice minOccurs="0" maxOccurs="unbounded"&gt; &lt;xsd:element name="step" type="lwis:stepType" /&gt; &lt;xsd:element name="fanout" type="lwis:fanoutType" /&gt; &lt;xsd:element name="decision"&gt; &lt;xsd:complexType&gt; &lt;!-- snip.. --&gt; &lt;/xsd:complexType&gt; &lt;/xsd:element&gt; &lt;/xsd:choice&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; </code></pre> <p><strong>ItineraryType</strong></p> <p>This is causing the <code>step</code> element to be mapped to two different properties which is causing your problem.</p> <pre class="lang-java prettyprint-override"><code>public class ItineraryType { @XmlElement(required = true) protected StepType step; @XmlElements({ @XmlElement(name = "step", type = StepType.class), @XmlElement(name = "fanout", type = FanoutType.class), @XmlElement(name = "decision", type = ItineraryType.Decision.class) }) protected List&lt;Object&gt; stepOrFanoutOrDecision; ... } </code></pre> <hr> <p><strong>SOLUTION</strong></p> <p>You can use the <a href="http://jaxb.java.net/nonav/2.2.1/docs/vendorCustomizations.html#simple" rel="nofollow">simple binding mode</a> extension in the JAXB XJC tool to support this use case. It will automatically prevent the <code>step</code> property from being created. You can specify this via an external binding document like the following:</p> <p><strong>bindings.xml</strong></p> <pre class="lang-xml prettyprint-override"><code>&lt;jxb:bindings xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" jxb:extensionBindingPrefixes="xjc" version="2.1"&gt; &lt;jxb:globalBindings&gt; &lt;xjc:simple /&gt; &lt;/jxb:globalBindings&gt; &lt;/jxb:bindings&gt; </code></pre> <p><strong>XJC Call</strong></p> <p>Below is how the external bindings file is referenced in an XJC call. You will need to also use the <code>-extension</code> flag to enable the XJC extension to be used.</p> <pre><code>xjc -extension -b bindings.xml schema.xsd </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload