[jdom-interest] Convert XML data to Java ojbects

Brett McLaughlin brett.mclaughlin at lutris.com
Tue Sep 5 07:33:53 PDT 2000


Guy Nirpaz wrote:
> 
> > >
> > > You need to give us more information; it's very fuzzy what you are
> > > doing. I think I know, but I doubt the rest of the list does. Post your
> > > configuration file (or an example), your use-case for doing this, and
> > > some detail about what the result is. Then we can talk on it further.
> > >
>  Sorry if I wasn't clear, it seems so obvious to me :-)
> 
>  The mechanism can be viewed as a combination of :
> 
>  JavaOutputter and ObjectBuilder (currently the names are different)
> 
>  The JavaOutputter - takes a Java instance and output it to XML document -
> or element
>  The ObjectBuilder - intantiates a Java instance out of XML element
> 
>  for example -
>  <code>
>  public class Person {
> 
>       private String firstName = null ;
>       private String lastName = null ;
>       private Address address = null ;
>  }
>  </code>
> 
>  with getXXX methods for properties is converted by default to -
> 
>  <?xml version="1.0" encoding="UTF-8"?>
>  <person>
>       <firstName>Michael</firstName>
>       <lastName>Jordan</lastName>
>       <address>
>            <street>Bulls court</street>
>            <houseNumber>100</houseNumber>
>            <state>IL</state>
>            <country>United Stated</country>
>       </address>
>  </person>
> 
>  This direction eliminates the need to code conversion to XML for every
> class
>  that can be described that way. For example - I use it to convert
>  EntityBeans to XML representation. By that the client application isn't
>  aware of the data actuall representation.
> 
>  The other direction is supported as well.
>  The exact XML doc above can instatiate a 'live' instance of Person class.

OK. Makes sense. Now could you explain (to others) why you would use
your methodology instead of data binding? Data Binding would create the
Person class for you, create the Address class for you, and then using a
Marshaller and Unmarshaller, convert back and forth. There wouldn't be a
need for this, if you used data binding... let us know what use case
this fills that a more standard methodoogy doesn't.

-Brett

p.s. There are good reasons for this, but I want to work through them
;-)

> 
>  Hope I was more clear now,
> 
>  Guy
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

-- 
Brett McLaughlin, Enhydra Strategist
Lutris Technologies, Inc. 
1200 Pacific Avenue, Suite 300 
Santa Cruz, CA 95060 USA 
http://www.lutris.com
http://www.enhydra.org



More information about the jdom-interest mailing list