2 Replies Latest reply: Aug 29, 2013 4:22 AM by user2659274 RSS

    JAXB custom property binding

    843834
      Hi,
      I have a following problem with my xml schema - I have specified a complex type called Clusters:
      <xsd:complexType name="Clusters">
           <xsd:sequence minOccurs="0" maxOccurs="unbounded">
                <xsd:element name="cluster" type="Cluster">
                     <xsd:annotation>
                          <xsd:appinfo>
                               <jxb:property name="clusters" />
                          </xsd:appinfo>
                     </xsd:annotation>
                </xsd:element>
           </xsd:sequence>
           <xsd:attribute name="dimensions" type="xsd:positiveInteger" use="required" />
      </xsd:complexType>
      When I'm trying to generate classes it fails with an error:
      [xjc] [ERROR] compiler was unable to honor this property customization. It is attached to a wrong place, or its inconsistent with other bindings.
            [xjc]   line 11 of file:/C:/Users/Krzysztof/workspace/Clusters/Clusters/schemas/clusters.xsd
      If I remove the minOccurs="0" maxOccurs="unbounded" from the sequence element than classes are generated but obviously clusters field is no longer a List but a Cluster.

      What can I do to be able to specify the sequence bounds - minOccurs="0" maxOccurs="unbounded" - and customize the property binding?
      Thank you in advance for answering