users@jaxb.java.net

Unsymmetrical validation

From: Adrian Brogan <adrian.brogan_at_burnsecs.com>
Date: Mon, 23 Feb 2004 10:36:50 -0000

Hope you can help.

 

 

Given the following as a fragment of a schema we use,

 

  <xsd:element name="PARTYCODE">

    <xsd:complexType mixed="false">

      <xsd:sequence>

        <xsd:element ref="IDDESC" minOccurs="0" maxOccurs="1"/>

        <xsd:element ref="IDCODE" minOccurs="1" maxOccurs="1"/>

      </xsd:sequence>

      <xsd:attribute name="IDTYPE" type="xsd:string" use="required"/>

    </xsd:complexType>

  </xsd:element>

 

when we parse an XML file based on the schema containing the above
fragment, and given the data for this fragment is

 

 

<PARTYCODE IDTYPE="a">

            <IDDESC>b</IDDESC>

            <IDTYPE></IDTYPE>

</PARTYCODE>

            

the unmarshall method reads in the data to the JAXB model without a
problem (even though the IDCODE element is empty).

 

However, when we recreate the XML document (after building up the JAXB
model from the same data), the marshal method reports the mandatory
element IDCODE missing.

 

Is this how is should behave?

 

We are using JAXB v1.02.

 

Thanks

 

Ade

 

------------------------------------------------------------------------
------------

Adrian Brogan

Software Engineer

Burns ECS

 

Address:Mansion House, Manchester Road, Altrincham, Cheshire, WA14 4RJ

mailto: adrian.brogan_at_burnsecs.com

 





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net