You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Carsten Ziegeler <cz...@s-und-n.de> on 2004/08/13 13:48:21 UTC

Strange code in CForms Binding

While looking through the cforms binding code I found at some places
code like this:

if (convertorEl != null) {
  String datatype = DomHelper.getAttribute(convertorEl, "datatype");
  String localeStr = convertorEl.getAttribute("datatype");
  if (!localeStr.equals("")) {
    convertorLocale = I18nUtils.parseLocale(localeStr);
  }
  convertor = assistant.getDatatypeManager().createConvertor(datatype,
convertorEl);
}

Now it seems that a locale informations is read from the datatype,
but as the datatype is not a correct locale information, always the
default locale is used (inside parseLocale()).

So, is this a typo?

Carsten 

Carsten Ziegeler 
Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.net/weblogs/rael/


RE: Strange code in CForms Binding

Posted by Carsten Ziegeler <cz...@s-und-n.de>.
Fixed (in trunk and 2.1.x)

Thanks
Carsten 

> -----Original Message-----
> From: Sylvain Wallez [mailto:sylvain@apache.org] 
> Sent: Friday, August 13, 2004 2:12 PM
> To: dev@cocoon.apache.org
> Subject: Re: Strange code in CForms Binding
> 
> Carsten Ziegeler wrote:
> 
> >While looking through the cforms binding code I found at some places 
> >code like this:
> >
> >if (convertorEl != null) {
> >  String datatype = DomHelper.getAttribute(convertorEl, "datatype");
> >  String localeStr = convertorEl.getAttribute("datatype");
> >  if (!localeStr.equals("")) {
> >    convertorLocale = I18nUtils.parseLocale(localeStr);
> >  }
> >  convertor = 
> assistant.getDatatypeManager().createConvertor(datatype,
> >convertorEl);
> >}
> >
> >Now it seems that a locale informations is read from the 
> datatype, but 
> >as the datatype is not a correct locale information, always 
> the default 
> >locale is used (inside parseLocale()).
> >
> >So, is this a typo?
> >  
> >
> 
> Definitely :-)
> 
> I never used that feature (as it is broken anyway), but it 
> should allow to specify the local to be used to bind typed 
> values to their string representation in a target XML 
> document (e.g. floating point numbers).
> 
> So this should be convertorEl.getAttribute("locale")
> 
> Sylvain
> 
> -- 
> Sylvain Wallez                                  Anyware Technologies
> http://www.apache.org/~sylvain           http://www.anyware-tech.com
> { XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
> 


Re: Strange code in CForms Binding

Posted by Sylvain Wallez <sy...@apache.org>.
Carsten Ziegeler wrote:

>While looking through the cforms binding code I found at some places
>code like this:
>
>if (convertorEl != null) {
>  String datatype = DomHelper.getAttribute(convertorEl, "datatype");
>  String localeStr = convertorEl.getAttribute("datatype");
>  if (!localeStr.equals("")) {
>    convertorLocale = I18nUtils.parseLocale(localeStr);
>  }
>  convertor = assistant.getDatatypeManager().createConvertor(datatype,
>convertorEl);
>}
>
>Now it seems that a locale informations is read from the datatype,
>but as the datatype is not a correct locale information, always the
>default locale is used (inside parseLocale()).
>
>So, is this a typo?
>  
>

Definitely :-)

I never used that feature (as it is broken anyway), but it should allow 
to specify the local to be used to bind typed values to their string 
representation in a target XML document (e.g. floating point numbers).

So this should be convertorEl.getAttribute("locale")

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }