You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by mj m <pd...@yahoo.com> on 2002/10/04 19:39:39 UTC

Betwixt and escaping

Hi,
I've been experimenting with Betwixt.  My need is very
simple.  I'd like to turn some existing beans into xml
files.  I've been able to do most of this fairly
easily, but am having problems with a few things.

1- Some of the bean properties contain strings with
special characters. In some cases html.  Many of these
are automatically escaped when I BeanWriter to output
the bean.  Some are not: specifically doublequote and
singlequote.  Is there something special I need to do
to include certain special characters in the escaping?

I looked at some of the junit testing files
(TestBeanWriter in particular) to make sure I was
structuring the code properly. 

2- Is there a way to exempt certain bean properties
when writing the bean out to xml?  For instance, if I
had a bean with the properties name, age, and gender,
but only wanted to include name and age in my xml?
I know I could simply create a new bean with name and
age only -- just wondering if there's a different way
to do it.


Thanks, 
mjm

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [Betwixt] escaping question

Posted by Martin van den Bemt <ml...@mvdb.net>.
Sorry for the late reply.. See inline.

On Thu, 2002-10-10 at 20:37, mj m wrote:
> 
> Hi,
> I've been experimenting with Betwixt.  My need is
> very
> simple.  I'd like to turn some existing beans into
> xml
> files.  I've been able to do most of this fairly
> easily, but am having problems with a few things.
> 
> 1- Some of the bean properties contain strings with
> special characters. In some cases html.  Many of
> these
> are automatically escaped when I BeanWriter to
> output
> the bean.  Some are not: specifically doublequote
> and
> singlequote.  Is there something special I need to
> do
> to include certain special characters in the
> escaping?

Attributes are correctly escaped (the quotes and doublequotes you
mentioned). The body of an element does not escape these (which is also
not necessary). If you can provide some examples (xml+beans+and maybe a
testcase), I can see what's wrong and fix it. 


> 
> I looked at some of the junit testing files
> (TestBeanWriter in particular) to make sure I was
> structuring the code properly. 
> 
> 2- Is there a way to exempt certain bean properties
> when writing the bean out to xml?  For instance, if
> I
> had a bean with the properties name, age, and
> gender,
> but only wanted to include name and age in my xml?
> I know I could simply create a new bean with name
> and
> age only -- just wondering if there's a different
> way
> to do it.

Create a .betwixt file for your bean that you want to hide properties
from, using the hide element (see
http://jakarta.apache.org/commons/betwixt/overview.html, section
"Customizing the mapping of a bean to XML"

Mvgr,
Martin

> 
> 
> Thanks, 
> mjm
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Faith Hill - Exclusive Performances, Videos & More
> http://faith.yahoo.com
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


[Betwixt] escaping question

Posted by mj m <pd...@yahoo.com>.
Hi,
I've been experimenting with Betwixt.  My need is
very
simple.  I'd like to turn some existing beans into
xml
files.  I've been able to do most of this fairly
easily, but am having problems with a few things.

1- Some of the bean properties contain strings with
special characters. In some cases html.  Many of
these
are automatically escaped when I BeanWriter to
output
the bean.  Some are not: specifically doublequote
and
singlequote.  Is there something special I need to
do
to include certain special characters in the
escaping?

I looked at some of the junit testing files
(TestBeanWriter in particular) to make sure I was
structuring the code properly. 

2- Is there a way to exempt certain bean properties
when writing the bean out to xml?  For instance, if
I
had a bean with the properties name, age, and
gender,
but only wanted to include name and age in my xml?
I know I could simply create a new bean with name
and
age only -- just wondering if there's a different
way
to do it.


Thanks, 
mjm


__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>