cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hubert Trzewik" <htrzewik-use...@prosystel.com.pl>
Subject Re: Woody - XML binding - float datatype - problem found
Date Tue, 20 Apr 2004 15:38:46 GMT
Marc, your solution looked pretty well, but in fact it does not work,
there is probably bug.

A message from erro message screen is:
java.lang.RuntimeException: Incorrect value type for "myfactor" (expected
class java.lang.Float, got class java.math.BigDecimal.

As you can see string from XML is converted but into "decimal" type -
don't know why..

ok.. now I found I can use decimal instead of float..
so, anyway, Marc, I found your advice usefull, thank you :)

>
>
> Hubert Trzewik wrote:
>> I found a problem with binding data to woody form.
>>
>> Example:
>> In this example binding works perfectly..
>>
>> XML data for binding:
>> <MyFactor>55</MyFactor>
>>
>> Form definition:
>> <wd:field id="myfactor">
>>   <wd:label>My facor:</wd:label>
>>   <wd:datatype base="string"/>
>> </wd:field>
>>
>> But if we change datatype in definition to
>> <wd:datatype base="float"/>
>> error shows up, that Cocoon expected float data and it recived string
>> type..
>>
>> Of course it's a string which should be parsed into float, but it's not.
>> Why? Is it my fault?
>>
>
> value-binding allows for specifying a string-to/from-datatype convertor:
>
> <wb:value id="myfactor" path="MyFactor">
>    <wd:convertor datatype="float" />
> </wb:value>
>
> this will require you to also declare the wd namespace
>
> this convertor will be used to transform your datatype back to a string
> for the XML backend.
>
> see:
> - http://wiki.cocoondev.org/Wiki.jsp?page=WoodyBinding
> - http://wiki.cocoondev.org/Wiki.jsp?page=WoodyDatatypeReference
>
> HTH
> -marc=
>
>>
>> Please someone check it or give an advice (if it's my falut). Maybe it's
>> a
>> case for Bugzilla.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>
> --
> Marc Portier                            http://outerthought.org/
> Outerthought - Open Source, Java & XML Competence Support Center
> Read my weblog at                http://blogs.cocoondev.org/mpo/
> mpo@outerthought.org                              mpo@apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message