You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Natalie Ng <nn...@hotmail.com> on 2003/02/20 00:59:43 UTC

Bean Utils - Generating XML for a DynaBean

Hi everyone, is there a simple way to generate an XML for the actual content 
of a DynaBean instance?

i.e.

<myBean>
   <name>Snoopy</name>
</myBean>

... not the following (generated by betwixt) ...

<myBean>
  <dynaClass>
    <dynaProperties>
      <DynaProperty>
        <mapped>false</mapped>
        <name>name</name>
        <type>class java.lang.String</type>
        <indexed>false</indexed>
      </DynaProperty>
    </dynaProperties>
  </dynaClass>
</myBean>

I could probably write my own implementation with JDom, but this seems to be 
generic enough that someone may have done already. Thanks.

cheers,
Natalie


_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus


RE: Bean Utils - Generating XML for a DynaBean

Posted by "Bradley M. Handy" <bh...@arbor.edu>.
Here are two classes I wrote.  The first (XMLDynaClass) is initialized
with an XML file.  The second (XMLDynaBean) does exactly what you would
specified in your request.  It handles nested data structures as well.
See the javadocs for details.

The two classes can be used separately from each other, so if you have
your own DynaClass implementation you can still use XMLDynaBean.  And,
if you have your own DynaBean implementations you can still use
XMLDynaClass.

Brad Handy

-----Original Message-----
From: Natalie Ng [mailto:nng1119@hotmail.com] 
Sent: Wednesday, February 19, 2003 7:00 PM
To: commons-user@jakarta.apache.org
Subject: Bean Utils - Generating XML for a DynaBean

Hi everyone, is there a simple way to generate an XML for the actual
content 
of a DynaBean instance?

i.e.

<myBean>
   <name>Snoopy</name>
</myBean>

... not the following (generated by betwixt) ...

<myBean>
  <dynaClass>
    <dynaProperties>
      <DynaProperty>
        <mapped>false</mapped>
        <name>name</name>
        <type>class java.lang.String</type>
        <indexed>false</indexed>
      </DynaProperty>
    </dynaProperties>
  </dynaClass>
</myBean>

I could probably write my own implementation with JDom, but this seems
to be 
generic enough that someone may have done already. Thanks.

cheers,
Natalie


_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org