Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This code is generated because your complex type, IDType, contains a choice with a maxOccurrence greater than one, here:</p> <p>&lt;xs:choice minOccurs="1" maxOccurs="2"&gt;</p> <p>The contents of this lists are elements with different <em>names</em> but the same <em>type</em>. This has no equivalent in standard object-oriented models. JAXB then uses the <code>JAXBElement</code> class to work around this: a <code>JAXBElement</code> wraps a simple object that contains the data and assigns it a <code>QName</code>.</p> <p>Thus you can read from this list and write to the list unambiguously by providing:</p> <ul> <li>The data object (in your case a String since all restrictions from String are represented as a Java String)</li> <li>A <code>JAXBElement</code> whose <code>getValue()</code> method returns the string</li> </ul> <p>The JAXB specification contains fairly detailed and reasonably complex explanations of how to deal with repeating choices and repeating sequences. Note that if your sequence contained objects of different types as well as different names, you would end up with <em>List&lt;Object&gt;</em>.</p> <p>That was the long explanation, now here are some options:</p> <ul> <li>If you can modify the schema, put a wrapper element around the 8 items, say, "Wrapper". Wrapper will contain a single choice of the elements; Then make IDType contain a sequence of Wrapper elements with minOccurs = 1 and maxOccurs = 2.</li> <li>Create yourself some helper functions to quickly create the JAXBElements. JAXB puts a Factory class in your target package that can help you - for example, it contains references to the Schema namespace, etc.</li> </ul>
 

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