Thank You ! Bindu.  I'll try this

"Shekar, Bindu" <[EMAIL PROTECTED]> wrote:
Shalini,
 
If you want to verify the value of a particular element of an object, you nee to write a handler for that particular element.
 
For an example, if you've a double field in your object, you can define the castor xml as for this element as
 
<field name="amount" type="java.lang.String"  handler="DoubleFieldHandler" create-method="createHandler">
   <bind-xml name="Amount"   node="element" />
  </field>
 
Where the above DoubleFieldHandler will extends from AbstractFieldHandler.
 
In the above DoubleFieldHandler, you need to write setValue and getValue method using reflection.
 
In setValue method, you can verify the value and if not valid one you can throw and exception.
 
Hope this helps you.
 
regards
bindus
 
-----Original Message-----
From: Shalni Kumar [mailto:[EMAIL PROTECTED]
Sent: Friday, June 10, 2005 9:58 AM
To: dev@castor.codehaus.org
Subject: [castor-dev] Can we validate the value of a XML field, before UnMarshalling ?

Hi !!
 
     I have a input XML String which i unmarshall(using Castor) and read values
     from it.
    
     Now I want to check the value of one field before I unmarshall
     and only if that field has a valid value, i want to continue with
     the unmarshalling, if not i just want to throw an error.
 
      Please give me some suggestions on how i can do this ?
 
      Hope to get some reply !!!!! :-)
 
Shalini

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


Discover Yahoo!
Have fun online with music videos, cool games, IM & more. Check it out!

Reply via email to