You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Venkata Krishnan <fo...@gmail.com> on 2006/10/08 11:55:28 UTC
About Node2Object Databinding Transformer
Hi Raymond,
Presently the :
org.apache.tuscany.core.databinding.xml.Node2Objecttransformer's
'getText' method returns the xml text as is packed with
whitespaces. Can it return the text after trimming it ? ...
protected String getText(Node source) {
if (source instanceof Document) {
source = ((Document)source).getDocumentElement();
}
return source.getTextContent().trim();
}
The reason I ask for this is that it makes a difference when configuring
component properties. i.e.
<property name="greeting">Hi There</property>
is different from ...
<property name="greeting">
Hi There
</property>
The second one returns the property value packed with whitespaces (including
the newline char). Also for numerical property values we might have have
problems in parsing.
Thanks
- Venkat
Re: About Node2Object Databinding Transformer
Posted by Venkata Krishnan <fo...@gmail.com>.
Hi Raymond,
Is there where you recommend the fix to be in SimpleTypeMapperExtension
public Object toJavaObject(TypeInfo simpleType, String value,
TransformationContext context) {
value = value.trim()
...
...
Shall I make this change and commit ? Please let me know. Thanks
- Venkat
On 10/9/06, Raymond Feng <en...@gmail.com> wrote:
>
> Hi,
>
> We probably should call the "trim()" in SimpleTypeMapperExtension.
>
> Thanks,
> Raymond
>
> ----- Original Message -----
> From: "Venkata Krishnan" <fo...@gmail.com>
> To: <tu...@ws.apache.org>
> Sent: Sunday, October 08, 2006 2:55 AM
> Subject: About Node2Object Databinding Transformer
>
>
> > Hi Raymond,
> >
> > Presently the :
> > org.apache.tuscany.core.databinding.xml.Node2Objecttransformer's
> > 'getText' method returns the xml text as is packed with
> > whitespaces. Can it return the text after trimming it ? ...
> >
> > protected String getText(Node source) {
> > if (source instanceof Document) {
> > source = ((Document)source).getDocumentElement();
> > }
> > return source.getTextContent().trim();
> > }
> >
> > The reason I ask for this is that it makes a difference when configuring
> > component properties. i.e.
> >
> > <property name="greeting">Hi There</property>
> >
> > is different from ...
> >
> > <property name="greeting">
> > Hi There
> > </property>
> >
> > The second one returns the property value packed with whitespaces
> > (including
> > the newline char). Also for numerical property values we might have
> have
> > problems in parsing.
> >
> > Thanks
> >
> > - Venkat
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
>
Re: About Node2Object Databinding Transformer
Posted by Raymond Feng <en...@gmail.com>.
Hi,
We probably should call the "trim()" in SimpleTypeMapperExtension.
Thanks,
Raymond
----- Original Message -----
From: "Venkata Krishnan" <fo...@gmail.com>
To: <tu...@ws.apache.org>
Sent: Sunday, October 08, 2006 2:55 AM
Subject: About Node2Object Databinding Transformer
> Hi Raymond,
>
> Presently the :
> org.apache.tuscany.core.databinding.xml.Node2Objecttransformer's
> 'getText' method returns the xml text as is packed with
> whitespaces. Can it return the text after trimming it ? ...
>
> protected String getText(Node source) {
> if (source instanceof Document) {
> source = ((Document)source).getDocumentElement();
> }
> return source.getTextContent().trim();
> }
>
> The reason I ask for this is that it makes a difference when configuring
> component properties. i.e.
>
> <property name="greeting">Hi There</property>
>
> is different from ...
>
> <property name="greeting">
> Hi There
> </property>
>
> The second one returns the property value packed with whitespaces
> (including
> the newline char). Also for numerical property values we might have have
> problems in parsing.
>
> Thanks
>
> - Venkat
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org