I was looking for object validation. Is there a document which explains
how to use the schema to generate the code.

Thanks

- Harjit 

-----Original Message-----
From: Werner Guttmann [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 21, 2007 3:51 PM
To: [email protected]
Subject: Re: [castor-user] Validation

If you happen to have a corresponding XML schema around, there's two
ways of validation supported by Castor at unmarshalling time.

- XML schema validation by the parser (configured through Castor's
castor.properties file)
- Object validation after successful unmarshalling. For this to work,
your Java classes need to be generated from the XML schema, as Castor's
source generator will create corresponding Validator clas instances
corresponding to your XML schema.

I hope this answers your question.

Werner

Singh, Harjit wrote:
>  
> 
>  
> 
> 
> Hi there,
> 
>  Is there any way to do some kind of simple data validation in Castor.
> For example, lets say when I'm reading the data from the XML, I want 
> to flag an error if there is no data for a particular element. Let say

> I have this XML, I need to flag an error if I see no value for the 
> title-cd element.
> 
> <aplct-indvl-title>
>               <id>
>                       <firm-crd-nb>11363</firm-crd-nb>
>                       <flng-seq-nb>1</flng-seq-nb>
>                       <title-seq-nb>3</title-seq-nb>
>                       <indvl-crd-nb>415771</indvl-crd-nb>
>               </id>
>               <title-cd>PRSDT</title-cd>
>       </aplct-indvl-title>
>       <aplct-indvl-title>
>               <id>
>                       <firm-crd-nb>11363</firm-crd-nb>
>                       <flng-seq-nb>1</flng-seq-nb>
>                       <title-seq-nb>4</title-seq-nb>
>                       <indvl-crd-nb>818536</indvl-crd-nb>
>               </id>
>               <title-cd></title-cd>
>       </aplct-indvl-title>
> 
> Thanks
> 
> - Harjit
> 
> 
> 
> This email, including attachments, may include confidential and/or 
> proprietary information, and may be used only by the person or entity 
> to which it is addressed.  If the reader of this email is not the 
> intended recipient or his or her authorized agent, the reader is 
> hereby notified that any dissemination, distribution or copying of 
> this email is prohibited. If you have received this email in error, 
> please notify the sender by replying to this message and delete this 
> email immediately.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
> 
>     http://xircles.codehaus.org/manage_email
> 


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email



This email, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity
to which it is addressed.  If the reader of this email is not the 
intended recipient or his or her authorized agent, the reader is 
hereby notified that any dissemination, distribution or copying of this 
email is prohibited. If you have received this email in error, 
please notify the sender by replying to this message and delete this 
email immediately.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to