Note that there are some explanatory texts on larger screens.

plurals
  1. POJaxB xjc generated pojos contains blank namespaces
    primarykey
    data
    text
    <p>I'm using xjc from the command line to generate POJOs from an XSD. Here's the command I run:</p> <pre><code>"%java_home%\bin\xjc" -p com.etc.etc.etc.etc ConsolidatedAlert.xsd </code></pre> <p>For some of the POJOs generated, the properties in the POJO come back like the following:</p> <pre><code>@XmlElement(name = "UnparsedTelephone", namespace="") protected String unparsedTelephone; </code></pre> <p>As far as I can tell, I don't specify these elements any differently than others that don't have the "namespace" attribute.</p> <p>Here's the relevant sections of the XSD:</p> <p>Type declaration:</p> <pre><code>&lt;xs:complexType name="TelephoneType"&gt; &lt;xs:choice&gt; &lt;xs:element name="UnparsedTelephone" type="xs:string"/&gt; &lt;xs:element name="ParsedTelephone" type="ParsedTelephoneType"/&gt; &lt;/xs:choice&gt; &lt;/xs:complexType&gt; </code></pre> <p>Element declaration:</p> <pre><code>&lt;xs:element name="Telephone" type="TelephoneType"/&gt; </code></pre> <p>Where "Telephone" is used:</p> <pre><code>&lt;xs:complexType name="CompanyContactType"&gt; &lt;xs:sequence&gt; &lt;xs:element ref="Telephone"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; </code></pre> <p>Where "CompanyContact" is used:</p> <pre><code>&lt;xs:complexType name="AmountType"&gt; &lt;xs:sequence&gt; &lt;xs:element ref="CompanyContact" minOccurs="0" /&gt; &lt;xs:element name="TriggerAmount" type="xs:string"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; </code></pre> <p>I can simply remove the namespace="" from each POJO, but that can take a bit, and I'd like a better understanding about why it's happening in the first place.</p> <p>Also, this is about 8 XSDs all linked together. They all have the same targetNamespace and xmlns in the schema definition, but some of them have elementFormDefault="unqualified" and others have elementFormDefault="qualified". Could this be the cause of the problem?</p> <p>Any ideas?</p>
    singulars
    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.
    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