commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <>
Subject Re: Roundtripping using Digester and Betwixt
Date Sun, 20 Aug 2006 10:24:33 GMT
Hi Jeff,

On Fri, 2006-08-18 at 13:19 -0700, Jeff Marendo wrote:
> Hello,
>   I'm using the Commons Digester, specifically, to read data from XML  files in order
to create objects and I later use Betwixt to write  objects out to XML.  I'm using Digester
"rules" files to specifiy  XML layout so a known pattern is used while reading and creating


>   How can I instruct Betwixt (the BeanWriter instance, I think) to write  out the info
so that it matches the pattern that I'm using when  reading?  Perhaps I should just be using
Betwixt for both reading  and writing, but I'd still like to be able to set things up,  explicitly,
so that the XML format for a given class is knowing ahead  of time (so the format for reading
and writing is the same).
>   Please reply, if someone has an idea about this.  Thanks!

Yes you should probably be using Betwixt for both reading and writing
(betwixt uses Digester internally for reading anyway).

You can create a .betwixt file for a class to define how you want the
xml to be written/read, eg for class "", create a file
"" containing the necessary definitions. This
file is used automatically when an object is *written to xml* by
betwixt. When reading xml, you do need to "register" the classes that
you expect to be reading from the xml; betwixt then finds the
appropriate .betwixt files for them to use when reading the xml in.

See the betwixt documentation for further details; the examples show how
to do all this.

If you do want to ask further questions on this list, please place the
name(s) of the relevant commons subprojects in the subject line, eg
  [betwixt][digester] How do I xxyyzzz...



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message