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

Steve Loughran steve.loughran at gmail.com
Sat Dec 22 18:16:31 EST 2007


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.


More information about the XOM-interest mailing list