Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] How to transform a POJO to "nu.xom.Document" ?

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: "Steve Loughran" <steve.loughran AT gmail.com>
  • To: elharo AT metalab.unc.edu
  • Cc: xom-interest <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] How to transform a POJO to "nu.xom.Document" ?
  • Date: Sat, 22 Dec 2007 15:16:31 -0800

On Dec 20, 2007 4:42 AM, Elliotte Rusty Harold <elharo AT metalab.unc.edu> wrote:
> Jin Xu wrote:
> > How to transform a POJO to "nu.xom.Document", please ?
> >
>
>
> Write the code to do it. There are no shortcuts. There is no object-XML
> mapping layer (and that's a feature, not a bug).
>

you could use something like JAXB to go POJO->XML, then parse the XML
into XOM. But you'd be exposed to the limitations of O/X mapping.

One option is to subclass all the Xom types, and build up your graph
using custom elements, then turn this straight into XML; provide a
custom factory to do the reverse at parse time. I've done this and it
works very well.




Archive powered by MHonArc 2.6.24.

Top of Page