Hi Dave,

Gary was right, you can validate your xml using Xerces and putting the 
validation and namespace properties to true.
However you were rigth too, there was a bug in Castor validation :+(.
I've committed some code in the CVS to correct it.

Let me know if it is fine for you,

Arnaud

> -----Original Message-----
> From: dave young [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 15, 2001 5:51 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [castor-dev] unmarshalling choices, expecting validation
> errors but not getting them
> 
> 
> Gary,
> 
> Thanks for your response and suggestion. Unfortunately my situation is 
> unchanged.
> 
> I'm pretty confident that I am using the latest version of castor (well, 
> i downloaded it at approximately 5:00am tuesday 14/8/2001 GMT)
> I compared the webcvs versions of the two files you mention and they are 
> identical to those that i am already using. :-)
> 
> I am still having the problem that within my environment, castor is not 
> detecting when a choice of mandatory elements contains no content 
> whatsoever. :-(
> 
> Once deserialised, if i interrogate the object directly, both choices 
> (getMilitary() and getCivilian()) return null, but the isValid() method 
> returns true.
> 
> Can anybody confirm to me that this should definitely be fixed in the 
> current cvs source snapshot of castor? If so, I must be doing something 
> wrong somewhere
> 
> regards,
> 
> dave young.
> 
> ps: after carrying out tests, we have realized that the bit of extra 
> source code i attached last time actually causes other problems 
> (noticeably when you have a choice full of optional elements and no 
> content for the choice is supplied).
> 
> pps: attached again for completeness is the xml schema and the xml 
> instance for which i would expect errors to occur:
> 
> -------------< start schema >---------------------
> <xsd:element name="SoldierOrCivilian">
> <xsd:complexType>
>       <xsd:choice>
>               <xsd:element name="Military" type="t_Military"/>
>               <xsd:element name="Civilian" type="t_Civilian"/>
>       </xsd:choice>
> </xsd:complexType>
> </xsd:element>
> 
> <xsd:complexType name="t_Military">
>       <xsd:sequence>
>               <xsd:element name="Rank" type="xsd:string"/>
>               <xsd:element name="Unit" type="xsd:string"/>
>       </xsd:sequence>
> </xsd:complexType>
> 
> 
> <xsd:complexType name="t_Civilian">
>       <xsd:sequence>
>               <xsd:element name="Name" type="xsd:string"/>
>               <xsd:element name="Company" type="xsd:string"/>
>       </xsd:sequence>
> </xsd:complexType>
> ----------------------<e nd schema >-----------------------
> 
> xml instance:
> <SoldierOrCivilian>
> </SoldierOrCivilian>
> 
> 
> 
> 
> > 
> > Dave,
> > 
> > I had the same problem. Its because the Unmarshaller in 0.9.3 did 
> not have an
> > ErrorHandler set.
> > 
> > Arnaud has fixed the problem in CVS around the 1st August.
> > 
> > Grab the latest Unmarshaller.java and UnmarshalHandler.java from 
> CVS and rebuild
> > the JAR
> > 
> > Regards,
> > 
> > Gary
> 
> ----------------------------------------------------------- 
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>       unsubscribe castor-dev

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

Reply via email to