You are welcome. Btw, just to make things clearer: if you were not to use a FieldHandler, you would assign a field type of 'string' anyhow. Even if you use a FieldHandler, you'd still want to instruct Castor to unmarshal to 'string' *before* calling your FieldHandler (which does the conversion toboolean in your case).

Regards
Werner

Grégoire Dariel wrote:
Great ! That works !

Thank you,
Greg

2008/2/16, Werner Guttmann <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>:

    Try this:

    <field name="natureModel" type="string"
            handler="MyGeneralizedFieldHandler">
         <bind-xml name="nat" node="attribute" />
    </field>

    Regargs
    Werner

    Grégoire Dariel wrote:
     > Hi,
     >
     > I'm using Castor 1.2 to unmarshall an XML file.
     >
     > In my XML, a field has either the value "model", either the value
    "nomodel".
     > My aim is to map this field into a boolean field such as "model" is
     > mapped to "true" and "nomodel" is mapped to "false".
     > I defined for this a GeneralizedFieldHandler.
     > My problem is that Castor passes a Boolean object to the
     > convertUponSet method of my handler instead of a String.
     >
     > Here is my mapping file :
     > <mapping>
     >     <class name="Task">
     >         <field name="natureModel" type="boolean"
     > handler="MyGeneralizedFieldHandler">
     >             <bind-xml name="nat" node="attribute" />
     >         </field>
     >     </class>
     > </mapping>
     >
     > Thanks for your help :)
     >
     > Greg
     >
     > ---------------------------------------------------------------------
     > 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




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

   http://xircles.codehaus.org/manage_email


Reply via email to