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>
<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: [email protected]
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 valuesfrom it.Now I want to check the value of one field before I unmarshalland only if that field has a valid value, i want to continue withthe 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

