java - Jaxb generated class used JAXBElement instead of specified type -


this question has been asked in various guises - feel there still room catalogue further.

i have xsd 2 element definitions

<xs:complextype name="elementa">    <xs:sequence>       <xs:element name="date" type="xs:string" minoccurs="0"/>       <xs:element name="lastxdigits" type="xs:string" nillable="true" minoccurs="0"/>    </xs:sequence> </xs:complextype> 

this generates:

protected string date; @xmlelementref(name = "lastxdigits", namespace = "http://xxxxxxx", type = jaxbelement.class) protected jaxbelement<string> lastxdigits; 

changing xsd to:

<xs:element name="lastxdigits" type="xs:string" nillable="true" minoccurs="1"/> 

results in:

protected string date; @xmlelement(name = "lastxdigits", required = true, nillable = true) protected string lastxdigits; 

and using:

<xs:element name="lastxdigits" type="xs:string" minoccurs="0"/> 

results in:

protected string date; @xmlelement(name = "lastxdigits") protected string lastxdigits; 

this seems extremely odd me. why lastxdigits generated jaxbelement type in first case , why string type not suffice in cases? also, why should jaxb treat these 2 elements differently when definition apart name identical?

i'm using jaxb-xjc ant task jaxb 2.0.5.

does suspicious or there justification these differences?

if nillable="true" minoccurs="0" impossible represent values string. null mean? mean null, or occurred 0 times? guess moot when comes string.

compare empty list. null list different empty one.


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -