Hi Ivelin

From: "Ivelin Ivanov" <[EMAIL PROTECTED]>
> Is there a rundown available on the reasons why Betwix is developing in
> paralel with JAXB?

Good question :-)


> I've used Castor for quite some time and have been happy with its
> performance.

JAXB takes the approach that a DTD (and one day an XML schema) is used to
generate beans that can parse/output the XML, then you can derive from them
to add behaviour.

Betwixt takes a different approach, that starting with any bean, it already
has a default XML representation; then betwixt can be customized with just
the differences you want (moving elements around, adding arbitrary extra XML
nestings, renaming elements/attributes etc). Then betwixt can parse XML
(using Digester, it essentially defaults digester rules) or output XML
straight away, then customize to make it esthetically nicer XML later.

On the list of things planned are SAX reader/writers and a DOM
implementation using betwixt's mappings, then XSLT can be used on beans
(like the Maven project does). Also I should finally get around to using
Betwixt to add a bean Navigator to the Jaxen XPath engine. Betwixt
essentially mirrors the Introspector / BeanInfo classes from java.beans but
for mapping information of beans to XML, so there's an XMLIntrospector and
XMLBeanInfo etc.


Both the JAXB & betwixt approaches are equally valid; JAXB is useful if you
want some beans generated from some kind of XML 'schema', betwixt is better
if you already have the beans and want to customize what the XML looks like,
or to automatically default digester rules for you, then maybe customize
things later.

So if you're starting from beans and want nice XML then betwixt is a good
tool for the job; if you're starting with a DTD and want to write some
beans, then look at JAXB.

Castor is kinda in the middle between them with a bit more complexity thrown
in for good measure but its got some good stuff in there. Though I always
get the impression Castor is trying to do too much together at the same time
rather than just doing one thing well, but maybe thats just me. I can't help
think of the phrase 'jack of all trades and master of none'. e.g. Castor is
JDO-like without being compliant, its kind of an O/R mapping tool, its a
reasonable O/XML mapping tool and a kinda OQL engine all thrown in together.
An impressive body of work though.

As an aside, betwixt focusses on the mapping metadata of how beans should
map to XML, so betwixt could maybe be used to generate Castor java <-> XML
bindings - though I'm not sure why you'd want to do that ;-)


> Apache Axis build their own JavaBean-XML mapping and Betwix is yet another
> development in the area.

Its on my list to investigate using Betwixt in Axis. SOAP supports various
different encodings, 1 of which (usually called the 'soap encoding') is a
well defined mapping of SOAP to java objects, so Axis probably implements
that spec.

However for some of the other encodings (such as none where you just get
XML), then maybe betwixt could be used to map a SOAP schema to some
implementation beans. i.e. to have a flexible, customizable mapping.

I'd certainly like try out a Betwixt based serializer/deserializer for Axis
and see if it works neatly.

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to