You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Fran Varin <FV...@AMICA.com> on 2006/12/07 15:32:03 UTC

[betwixt] Question on complex documents

Hi, I've started to do some investigating where Betwixt is concerned so, keep
in mind I'm new to this API. One thing that occurs to me and I cannot seem
to find an answer to in the docs or tutorial is that how can Betwixt handle
a situation where I have a complex document with many repeating complex
attributes? I may have a Bean that encapsulates other Objects that manage
data on my behalf and have a complex XML document with a high degree of
nesting and re-occurring elements. I don't see a clear way to describe this
type of situation. I've been able to get a simple XML document described and
a simple bean populated but, I don't even know where to start if I suddenly
start to introduce Object types other than simple Strings. For instance a
getter that returns a Hashtable for instance. How can Betwixt accommodate
such a an entity or is it really the intent to keep the return types as
atomic as possible? So, my impression is that for very complex XML I'm
wondering about the viability of Betwixt. I'm willing to admit that I could
be naive about its capabilities but, I just don't see how it can be feasible
to accommodate highly complex documents. 
-- 
View this message in context: http://www.nabble.com/-betwixt--Question-on-complex-documents-tf2774711.html#a7740211
Sent from the Commons - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [betwixt] Question on complex documents

Posted by Markus Härnvi <ja...@harnvi.net>.
Hi!

Betwixt has no problems with complex object graphs. My typical XML  
files are 1.5 Mb. They contai Maps and Lists, containing other  
objects and Lists.

Polymorphism can be a bit tricky. I need a .betwixt file for most of  
my classes to get deserialization working.

Another area where you might need to do some extra work is when  
classes need constructor arguments to be instantiated. I serialize  
java.awt.Color and java.util.Locale and I had to implement  
ChainedBeanCreator for them to get them deserialized. It's all in the  
documentation.

I have had some issues along the way, but I don't regret going with  
Betwixt. I haven't found a better way to serialize Javabeans to XML.  
If I had a schema based XML to work with, I might have picked  
XMLBeans or JAXB.

      /Markus


>
> Hi, I've started to do some investigating where Betwixt is  
> concerned so, keep
> in mind I'm new to this API. One thing that occurs to me and I  
> cannot seem
> to find an answer to in the docs or tutorial is that how can  
> Betwixt handle
> a situation where I have a complex document with many repeating  
> complex
> attributes? I may have a Bean that encapsulates other Objects that  
> manage
> data on my behalf and have a complex XML document with a high  
> degree of
> nesting and re-occurring elements. I don't see a clear way to  
> describe this
> type of situation. I've been able to get a simple XML document  
> described and
> a simple bean populated but, I don't even know where to start if I  
> suddenly
> start to introduce Object types other than simple Strings. For  
> instance a
> getter that returns a Hashtable for instance. How can Betwixt  
> accommodate
> such a an entity or is it really the intent to keep the return  
> types as
> atomic as possible? So, my impression is that for very complex XML I'm
> wondering about the viability of Betwixt. I'm willing to admit that  
> I could
> be naive about its capabilities but, I just don't see how it can be  
> feasible
> to accommodate highly complex documents.