Hi,

We have been using Castor's XML databinding for a while for our B2B service
project and were quite happy about it. Recently,  though, we have bumped
into the following problem:

when unmarshalling from XML:

<Envelope>
     <ELEMENTC>9999</ELEMENTC>
     <ELEMENTD>A02</ELEMENTD>
</Envelope>

into classes generated by the following schema:

<xsd:element name = "Envelope">
        <xsd:complexType mixed = "false">
                    <xsd:choice minOccurs = "1" maxOccurs = "3">
                     <xsd:element ref = "ELEMENTA" minOccurs = "0"
maxOccurs = "1"/>
                     <xsd:element ref = "ELEMENTB" minOccurs = "0"
maxOccurs = "1"/>
                     <xsd:sequence minOccurs = "0" maxOccurs = "1">
               <xsd:element ref = "ELEMENTC"/>
                                   <xsd:element ref = "ELEMENTD" minOccurs
= "0" maxOccurs = "1"/>
                     </xsd:sequence>
                </xsd:choice>
        </xsd:complexType>
    </xsd:element>,

Castor creates two sequences instead of one and then gets confused during
the validation step (validation exception: ELEMENTD is a required field). A
slightly different schema, where both children of the sequence are
optional:

<xsd:element name = "Envelope">
        <xsd:complexType mixed = "false">
                    <xsd:choice minOccurs = "1" maxOccurs = "3">
                     <xsd:element ref = "ELEMENTA" minOccurs = "0"
maxOccurs = "1"/>
                     <xsd:element ref = "ELEMENTB" minOccurs = "0"
maxOccurs = "1"/>
                     <xsd:sequence minOccurs = "0" maxOccurs = "1">
               <xsd:element ref = "ELEMENTC" minOccurs = "0" maxOccurs
= "1"/>
                                   <xsd:element ref = "ELEMENTD" minOccurs
= "0" maxOccurs = "1"/>
                     </xsd:sequence>
                </xsd:choice>
        </xsd:complexType>
    </xsd:element>

works perfectly well.

Is it a known problem and is there a fix for it?

Thank you,

Max.

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to