java - JAXB Generation nillable=true -
using jaxb 2.2.4 generating java code following binding file:
<bindings xmlns="http://java.sun.com/xml/ns/jaxb" version="2.0" xmlns:xs="http://www.w3.org/2001/xmlschema"> <globalbindings generateelementproperty="false"> </globalbindings>
unfortunately, generated code has nillable = true annotation. see following example:
@xmlelement(name = "artid", nillable = true) protected stebeitrag artid;
this definition of stebeitrag:
<xsd:complextype name="ct_beitrag"> <xsd:complexcontent> <xsd:extension base="allgemein:ct_objekt"> <xsd:sequence> <xsd:element name="artid" type="daten:ste_beitrag" minoccurs="0" maxoccurs="1" nillable="true"/></xsd:element> </xsd:sequence> </xsd:extension> </xsd:complexcontent> </xsd:complextype>
<xsd:complextype name="ste_beitrag" abstract="true"> <xsd:simplecontent> <xsd:extension base="xsd:string"/> </xsd:simplecontent> </xsd:complextype>
if not set artid in generated ct_beitrag object unmarshaller produces output
<ns:artid xsi:nil="true"/>
the element artid has abstract type , therefore xml output invalid.
how can generate code jaxb omits nillable=true in xmlelement annotation? way, schema can´t changed.
i have no solution, problem addressed in bug http://java.net/jira/browse/jaxb-890 hope problem wil solved.
Comments
Post a Comment