commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <>
Subject Re: [Betwixt] Some ideas
Date Fri, 14 Jun 2002 04:08:39 GMT
Hi Stephen

From: "Stephen Colebourne" <>
> Hi,
> A while back I looked at using Betwixt for my Bean to XML generation
> In the end I rolled my own (time pressure was a factor), but I would still
> like to refactor Joda to use betwixt if possible in the longer term.
> As you are talking about a 1.0 release, I thought I'd jot down some of the
> ideas which I implemented in my Bean to XML code that aren't (yet) in
> betwixt. Maybe some might make it to the todo list?
> 1) SAX outputter - I believe this is on the todo list already ;-)


> 2) ID's as Strings - Betwixt uses ints for it's ID/IDREF values (to handle
> recursion). I needed Strings, to allow for more complex generated ids
> including IP ref etc. This would be a faily easy change to make, but after
> release it would break backwards compatability?

This sounds cool I think. The use of ID/IDREF is optional anyways so it
shouldn't break anything.

> 3) ID's controlled on a per object basis - I created an Identifiable
> interface with getIdentifier and setIdentifier methods. Those beans which
> implemented it outputted an ID/IDREF. Those which didn't implement it were
> output directly, with the potential for (the exception case) recursion.

Not totallyl sure how this would work but it sounds very reasonable. Maybe
registering some kind of Resolver to lookup beans for some kind of ID;
though you can use straight Digester code for that too.

> 4) Subclass handling - When I last looked, I could find no automatic
> handling of class hierarchies. For example, the automatic generation of a
> type attribute if the class being output is a subclass of that expected.

Agreed - this would be nice.

> 5) End of  line handling - I have read in the JDOM source code that the
> of line in XML documents must be \n on all systems. So should betwixt have
> the setEndOfLine() method on BeanWriter?

Agreed. Yes "\n" is the default for XML (its like that in dom4j too ;-).


Do You Yahoo!?
Get your free address at

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

View raw message