users@jaxb.java.net

Complex binding for unbounded sequence

From: Richard Eardley <reardley_at_janacorp.com>
Date: Fri, 9 Sep 2011 06:45:30 -0700 (PDT)

I have a schema S1000D 2.3 which contains the following fragment. Within
figureType we have a choice of sequences, the second being unbounded. These
sequences share the same element refs (graphic, rfa)
 and by extension (titles) the applic element. I have tried to resolve
these conflicts with a binding file, but I cannot get it to work. Some
bindings are recognized while others are not.

An excerpt of my binding file follows the xsd.

    <xs:complexType name="figureType">
        <xs:sequence>
            <xs:group ref="titles"/>
            <xs:choice>
                <xs:sequence>
                    <xs:element ref="graphic"/>
                    <xs:element maxOccurs="unbounded" minOccurs="0"
ref="rfa"/>
                </xs:sequence>
                <xs:sequence maxOccurs="unbounded">
                    <xs:element minOccurs="0" ref="applic"/>
                    <xs:element ref="sheet"/>
                    <xs:element ref="graphic"/>
                    <xs:element maxOccurs="unbounded" minOccurs="0"
ref="rfa"/>
                </xs:sequence>
            </xs:choice>
            <xs:element minOccurs="0" ref="legend"/>
        </xs:sequence>
        <xs:attribute ref="refapplic"/>
        <xs:attributeGroup ref="bodyatt"/>
        <xs:attributeGroup ref="secur"/>
    </xs:complexType>
    <xs:group name="titles">
        <xs:sequence>
            <xs:element minOccurs="0" ref="applic"/>
            <xs:element ref="title"/>
        </xs:sequence>
    </xs:group>

        <jxb:bindings
node="//xs:complexType[@name='figureType']/xs:sequence/xs:choice">
                <jxb:bindings node="./xs:sequence[position()=2]">
                        <jxb:bindings node="./xs:element[@ref='applic']">
                                <jxb:property name="oapplic"/>
                        </jxb:bindings>
                        <jxb:bindings node="./xs:element[@ref='graphic']">
                                <jxb:property name="firstgraphic"/>
                        </jxb:bindings>
                </jxb:bindings>
                <jxb:bindings
node="//xs:complexType[@name='figureType']/xs:sequence/xs:choice">
                        <jxb:bindings node="./xs:sequence[position()=2]">
                                <jxb:bindings node="./xs:element[@ref='rfa']">
                                        <jxb:property name="firstrfa"/>
                                </jxb:bindings>
                        </jxb:bindings>
                </jxb:bindings>
        </jxb:bindings>


Any ideas?

-- 
View this message in context: http://old.nabble.com/Complex-binding-for-unbounded-sequence-tp32431611p32431611.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.