Note that there are some explanatory texts on larger screens.

plurals
  1. POJAXB Types problem
    primarykey
    data
    text
    <p>I have an xsd that looks like this (snippet):</p> <pre><code>&lt;xs:complexType name="IDType"&gt; &lt;xs:choice minOccurs="1" maxOccurs="2"&gt; &lt;xs:element name="FileID" minOccurs="0" maxOccurs="1" type="an..35" /&gt; &lt;xs:element name="IDNumber1" minOccurs="0" maxOccurs="1" type="an..35" /&gt; &lt;xs:element name="Number" minOccurs="0" maxOccurs="1" type="an..35" /&gt; &lt;xs:element name="PNumber" minOccurs="0" maxOccurs="1" type="an..35" /&gt; &lt;xs:element name="SS" minOccurs="0" maxOccurs="1" type="an..35" /&gt; &lt;xs:element name="Player" minOccurs="0" maxOccurs="1" type="an..35" /&gt; &lt;xs:element name="Prior" minOccurs="0" maxOccurs="1" type="an..35" /&gt; &lt;xs:element name="BIN" minOccurs="0" maxOccurs="1" type="an..35" /&gt; &lt;xs:element name="Mutual" minOccurs="0" maxOccurs="1" type="an..35" /&gt; &lt;/xs:choice&gt; &lt;/xs:complexType&gt; &lt;xs:simpleType name="an..35"&gt; &lt;xs:restriction base="an"&gt; &lt;xs:maxLength value="35" /&gt; &lt;/xs:restriction&gt; &lt;/xs:simpleType&gt; &lt;xs:simpleType name="an"&gt; &lt;xs:restriction base="xs:string"&gt; &lt;xs:pattern value="[ !-~]*" /&gt; &lt;/xs:restriction&gt; &lt;/xs:simpleType&gt; </code></pre> <p>For some reason this is the Java code that gets generated:</p> <pre><code>@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "IDType", propOrder = { "fileID" }) public class PatientIDType { @XmlElementRefs({ @XmlElementRef(name = "FileED", namespace = "http://www.surescripts.com/messaging", type = JAXBElement.class), @XmlElementRef(name = "IDNumber1", namespace = "http://www.surescripts.com/messaging", type = JAXBElement.class), @XmlElementRef(name = "Number", namespace = "http://www.surescripts.com/messaging", type = JAXBElement.class), @XmlElementRef(name = "PNumber", namespace = "http://www.surescripts.com/messaging", type = JAXBElement.class), @XmlElementRef(name = "SS", namespace = "http://www.surescripts.com/messaging", type = JAXBElement.class), @XmlElementRef(name = "Plaer", namespace = "http://www.surescripts.com/messaging", type = JAXBElement.class), @XmlElementRef(name = "Prior", namespace = "http://www.surescripts.com/messaging", type = JAXBElement.class), @XmlElementRef(name = "BIN", namespace = "http://www.surescripts.com/messaging", type = JAXBElement.class), @XmlElementRef(name = "Mutual", namespace = "http://www.surescripts.com/messaging", type = JAXBElement.class) }) protected List&lt;JAXBElement&lt;String&gt;&gt; fileID; /** * Gets the value of the fileID property. * * &lt;p&gt; * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a &lt;CODE&gt;set&lt;/CODE&gt; method for the fileID property. * * &lt;p&gt; * For example, to add a new item, do as follows: * &lt;pre&gt; * getFileID().add(newItem); * &lt;/pre&gt; * * * &lt;p&gt; * Objects of the following type(s) are allowed in the list * {@link JAXBElement }{@code &lt;}{@link String }{@code &gt;} * {@link JAXBElement }{@code &lt;}{@link String }{@code &gt;} * {@link JAXBElement }{@code &lt;}{@link String }{@code &gt;} * {@link JAXBElement }{@code &lt;}{@link String }{@code &gt;} * {@link JAXBElement }{@code &lt;}{@link String }{@code &gt;} * {@link JAXBElement }{@code &lt;}{@link String }{@code &gt;} * {@link JAXBElement }{@code &lt;}{@link String }{@code &gt;} * {@link JAXBElement }{@code &lt;}{@link String }{@code &gt;} * {@link JAXBElement }{@code &lt;}{@link String }{@code &gt;} */ public List&lt;JAXBElement&lt;String&gt;&gt; getFileID() { if (fileID == null) { fileID = new ArrayList&lt;JAXBElement&lt;String&gt;&gt;(); } return this.fileID; } </code></pre> <p>Why is the class generated like this and simply not some kind of string array? I really don't want to have to create JAXBElements every time I want to create something?</p> <p>How can I have it generate classes for each of the types that simply represent string or something like that?</p> <p>Thanks in advance,</p> <p>Ian</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
 

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