geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Strachan <>
Subject Re: XMLBeans, a quick comment
Date Sat, 16 Aug 2003 08:01:17 GMT

On Saturday, August 16, 2003, at 10:09  am, Aaron Mulder wrote:

> 	I think what he means is that Castor, as configured, generates
> more or less POJOs -- if you look at the * classes in
> org.apache.geronimo.twiddle.config, there's nothing Castor or XML 
> specific
> at all.  I take advantage of this too in the JSR-88 code I'm about to 
> send
> out.  One of the advantages here is for JSR-88, you can populate a set 
> of
> deployment information JavaBeans either from the JSR-88 DConfigBeans, 
> or
> from an XML DD.  It's a one-liner to load or store an XML file, but the
> actual objects have no particular XML code in them.  (Granted, the
> separate set of XXXDescriptor objects *do* have the XML stuff.)
> 	That said, I haven't seen what XMLBeans generates, so I don't know
> how it compares.

The main differences as far as I can see are

* makes beans + separate Descriptor classes
* beans have no dependencies on Castor but the Descriptor classes do
* doesn't currently handle the j2ee schemas - am no expert maybe 
someone could fix it?
* use the Castor API to marshall / demarshall

* generates interfaces + implementations; implementations in a separate 
* no descriptors (so javadoc is cleaner)
* fully supports XML Schema
* lossless (i.e. comments from XML config files preserved etc)
* generated code is dependent on xmlbeans.jar; e.g. the interfaces 
extend XmlObject which provides a polymorphic way to iterate through 
the beans as XML etc
* the XmlObject API allows you to do XPath queries, schema validations 
at any time (useful in GUIs and such like) and various other XML 
related things
* each generated interface has an inner Factory class for doing parsing 
etc; so the use of xmlbeans API is hidden inside the generated beans - 
so there's no visible external API

Right now I can't get Castor to work; hence the reason I looked at JAXB 
and XMLBeans. So far I quite like the looks of XMLBeans in that it 
works with the j2ee schemas, it fully supports XML Schema, has XPath + 
XML Schema validation integrated and the lossless XML feature could be 
handy. Only real downside is that the generated beans depend on the 
xmlbeans jar. I'd also prefer just to create beans rather than 
interfaces + implementations but thats a more minor thing.


View raw message