Hi,
I'm not sure if this can help, however I already noticed that when the XML contains an empty element the object's corresponding setter is called with a null value instead of the empty String ""...
Anyhow, this is not a schema validation error, if so it would be a SAXException thrown by the parser.
It might rather be a Castor validation problem, try turning off Castor validation on your unmarshaller (Unmarshaller#setValidation(boolean))
Claude
> -----Original Message-----
> From: sire chembiparambil [mailto:[EMAIL PROTECTED]]
> Sent: 22 May 2004 23:37
> To: [EMAIL PROTECTED]
> Subject: [castor-dev] minOccurs versus enumeration question
>
>
>
>
>
>
>
> I have a schema element declared as below
>
> <xs:element name="LOC_DATA">
> <xs:complexType>
> <xs:sequence>
> <xs:element ref="NAME"/>
> <xs:element ref="TYPE" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> <xs:element name="NAME" type="locnameType"/>
> <xs:element name="TYPE" type="locType"/>
> <xs:simpleType name="locnameType">
> <xs:restriction base="xs:string">
> <xs:minLength value="1"/>
> <xs:maxLength value="12"/>
> </xs:restriction>
> </xs:simpleType>
> <xs:simpleType name="locType">
> <xs:restriction base="xs:string">
> <xs:enumeration value="N"/>
> <xs:enumeration value="A"/>
> <xs:enumeration value=""/>
> </xs:restriction>
> </xs:simpleType>
>
> The xml doc that I am trying to unmarshall is
>
> <LOC_DATA>
> <NAME>CHICAGO</NAME>
> <TYPE></TYPE>
> <LOC_DATA>
>
> Using the default marshalling code (ie. without using any
> custom mapping
> file) I get an exception
>
> ValidationException: The field '_TYPE' (whose xml name is 'TYPE') is a
> required field.;
>
> I can explain this, since there is no minOccurs/maxOccurs
> attr specified in
> the schema, so it defaults it to " minOccurs=1 maxOccurs=1"
> which implies in the schema <xs:element ref="TYPE" /> ==
> <xs:element
> ref="TYPE" minOccurs="1" maxOccurs="1" />
>
> Ok,now my question is, since blank ("") is a valid enumertion
> for locType,
> which one should take precedence ? Castor seems to think that
> since the
> minOccurs is not specified, it should be present and seems to
> ignore the "
> <xs:enumeration value=""/>" schema specification.
>
> I tried to validate the same xml document using XMLSpy and it
> validates it.
> So which is the correct interpretation in such cases ?
>
> thanks
> Sire
>
>
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>
__________________________________________________________________________
· This email and any files transmitted with it are CONFIDENTIAL and intended
solely for the use of the individual or entity to which they are addressed.
· Any unauthorized copying, disclosure, or distribution of the material within
this email is strictly forbidden.
· Any views or opinions presented within this e-mail are solely those of the
author and do not necessarily represent those of Odyssey Asset Management
Systems SA unless otherwise specifically stated.
· An electronic message is not binding on its sender. Any message referring to
a binding engagement must be confirmed in writing and duly signed.
· If you have received this email in error, please notify the sender immediately
and delete the original.
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
