Hi Gary,

In Castor we can see 2 different validations:
        - the validation of an object model during (un)marshalling
        - the validation of the xml document towards its grammar during the parsing

1) The validation of the object model occurs when you provide an object model
and a set
of descriptors that defined some "data constraints" on this object model.
Typically when using the source code generator, you might want to use this
validation.
It is a real alternative for validating data and structure of an object model
defined
by an XML Schema.

2) When parsing an xml document in Castor, you can decide to validate it towards
a grammar
(and in this case you don't have any object model, just an xml document and its
grammar).
Ypu can do it by setting the relevant property in the parser you use.
Castor can set it for you, if you set it in the property file of Castor.
This has nothing to with unmarshaller.setValidation (that is NOT a static
method).

Hope to help you understanding the validation process in Castor,

Arnaud

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 15, 2001 2:15 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [castor-dev] unmarshalling choices, expecting validation
> errors but not getting them
>
>
>
>
> Hi Arnaud,
>
> Which files did you check in for the latest validation fix ? Looking through
> WebCVS I can't see anything relevant that has changed recently.
>
> On an additional point, I've been trying to programmatically control whether
> validation occurs during unmarshalling.
>
> As a result of my tests I've come to the following assumptions:
>
> (1)  The property, org.exolab.castor.parser.validation, in
> castor.properties is
> the only way of causing validation to happen or not during unmarshalling
> (2)  Validation of the mapping file and the input document either
> both happen or
> neither happens ( controlled by property above )
> (3)  Unmarshaller.setValidation( boolean ) has absolutely no effect on whether
> validation happens or not
>
> Could you, or somebody in the know, please verify whether this is the intended
> behaviour ?
>
> Thanks,
>
> Gary
>
>
>
>
>
> "Arnaud Blandin" <[EMAIL PROTECTED]> on 15 Aug 2001 11:00
>
>
>
>
>
>
>
>
>
> To:   [EMAIL PROTECTED]
> cc:     (bcc: Gary C JANES/GMIITD/HSBCMERIDIAN)
> Subject:  Re: [castor-dev] unmarshalling choices, expecting validation errors
> but not getting them
>
>
>
>
>
>
> 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
>
>
>
> ************************************************************
> This message originated from the Internet. Its originator
> may, or may not be who they claim to be, and the information
> contained herein may, or may not be accurate.
> ************************************************************
>
>
>
>
>
>
>
>
> The HSBC Group's website is at http://www.hsbc.com
> ************************************************************************
> HSBC Bank plc, which is regulated in the UK by SFA, has issued the
> information contained in this message (including any attached documents)
> for its non-private customers only. This message and any attachments are
> not an invitation to buy or sell securities or related financial instruments,
> are confidential to the named recipient and may also be privileged. The
> information should not be reproduced and/or distributed to any other
> person. Internet communications are not secure and HSBC Bank plc
> accepts no legal responsibility for the contents of this message.
> HSBC Bank plc makes no representation and accepts no responsibility
> or liability as to the completeness and accuracy of the information
> contained in this message. Opinions may change without notice and
> members of the HSBC Group may have positions in, or trade in instruments
> mentioned in this message. Each page attached hereto must be read in
> conjunction with any disclosure which forms part of it.
> ************************************************************************
>
> -----------------------------------------------------------
> 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