Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 29205 invoked from network); 22 Mar 2004 16:56:14 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 22 Mar 2004 16:56:14 -0000 Received: (qmail 70556 invoked by uid 500); 22 Mar 2004 16:56:01 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 70515 invoked by uid 500); 22 Mar 2004 16:56:01 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 70500 invoked from network); 22 Mar 2004 16:56:00 -0000 Received: from unknown (HELO maillnx-us312.fmr.com) (192.223.178.27) by daedalus.apache.org with SMTP; 22 Mar 2004 16:56:00 -0000 Received: from virmmk111nts.fmr.com (virmmk111nts.fmr.com [172.25.106.96]) by maillnx-us312.fmr.com (Switch-3.1.2/Switch-3.1.0) with SMTP id i2MGu2pg004012 for ; Mon, 22 Mar 2004 11:56:02 -0500 content-class: urn:content-classes:message Subject: Betwixt Configuration to process XML-formatted values MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPartTM-000-bb21b2c0-66e4-4b9f-996c-7236ba25c48b" Date: Mon, 22 Mar 2004 11:51:25 -0500 Message-ID: <21999CEEB6D9BE45AFEDA804E3484E750204D21B@MSGDALCLA2WIN.DMN1.FMR.COM> X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Betwixt Configuration to process XML-formatted values Thread-Index: AcQQJo4Uqit7J+bcQey5tWd9xhMH7wAA5V5wAAC/e4AAAC7bUA== From: "Nechiporenko, Maxim" To: X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N ------=_NextPartTM-000-bb21b2c0-66e4-4b9f-996c-7236ba25c48b Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C4102D.E9E66390" ------_=_NextPart_001_01C4102D.E9E66390 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > I am having trouble marshalling a JavaBean with one of its attribute > values set to a text which is an XML string. I have a JavaBean > Foo.java, and I use Commons Betwixt to marshall JavaBean in XML. Here > is what I am doing: >=20 > // JavaBean > public class Foo > { > private String val =3D null; >=20 > public void setVal (String val) > { > this.val =3D val; > } >=20 > public String getVal() > { > return this.val; > } > } >=20 > // Test program > import java.io.StringWriter; > import org.apache.commons.betwixt.io.BeanWriter; >=20 > public class test > { > public static void main (String [] args) > { > test t =3D new test(); > t.doStuff(); > } > =20 > public void doStuff() > { > Foo bean =3D new Foo(); > bean.setVal("Some Error]]"); >=20 > StringWriter outputWriter =3D new StringWriter(); > BeanWriter beanWriter =3D new BeanWriter(outputWriter); > beanWriter.getXMLIntrospector().setAttributesForPrimitives(false); > beanWriter.setWriteIDs(false); > beanWriter.enablePrettyPrint(); > beanWriter.write("foo", bean); > System.out.println("XML: "+ outputWriter.toString()); > } > =20 > The XML I am getting looks the following: >=20 > > > <![CDATA[<error>Some Error</error>]]> > > >=20 > when I would need it to be: >=20 > > > Some Error]] > > >=20 > I have no issues marshalling this Bean using Castor. Any help on how > to get Betwixt to produce the desired XML string is welcome. >=20 > Thanks, > Max >=20 ------_=_NextPart_001_01C4102D.E9E66390 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Betwixt Configuration to process XML-formatted values

I am having trouble marshalling a = JavaBean with one of its attribute values set to a text which is an XML  string.  I have a = JavaBean Foo.java, and I use Commons Betwixt to marshall JavaBean in = XML. Here is what  I am doing:

// JavaBean
public class Foo
{
  private String val =3D = null;

  public void setVal (String = val)
  {
    this.val =3D = val;
  }

  public String getVal()
  {
    return = this.val;
  }
}

// Test program
import java.io.StringWriter;
import = org.apache.commons.betwixt.io.BeanWriter;

public class test
{
  public static void main (String = [] args)
  {
    test t =3D new = test();
    t.doStuff();
  }
 
  public void doStuff()
  {
    Foo bean =3D new = Foo();
    = bean.setVal("<![CDATA[<error>Some = Error</error>]]");

    StringWriter = outputWriter =3D new StringWriter();
    BeanWriter = beanWriter =3D new BeanWriter(outputWriter);
    = beanWriter.getXMLIntrospector().setAttributesForPrimitives(false);=
    = beanWriter.setWriteIDs(false);
    = beanWriter.enablePrettyPrint();
    = beanWriter.write("foo", bean);
    = System.out.println("XML:  "+ = outputWriter.toString());
  }
 
The XML I am getting looks the = following:

<foo>
  <val>
    = &lt;![CDATA[&lt;error&gt;Some = Error&lt;/error&gt;]]&gt;
  </val>
</foo>

when I would need it to be:

<foo>
  <val>
    = <![CDATA[<error>Some Error</error>]]
  </val>
</foo>

I have no issues marshalling this Bean = using Castor. Any help on how to get Betwixt to produce the = desired  XML string is welcome.

Thanks,
Max

------_=_NextPart_001_01C4102D.E9E66390-- ------=_NextPartTM-000-bb21b2c0-66e4-4b9f-996c-7236ba25c48b Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org ------=_NextPartTM-000-bb21b2c0-66e4-4b9f-996c-7236ba25c48b--