How would I go about building a set of objects in the xbeans module just by api and completely outside of XML? Is this possible? If so, are there any problems which might arise from doing so?

--jason


On Saturday, August 16, 2003, at 03:01 PM, James Strachan wrote:


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 *Config.java 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

Castor
* 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


XMLBeans
* generates interfaces + implementations; implementations in a separate package
* 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.


James
-------
http://radio.weblogs.com/0112098/




Reply via email to