Hi Lance

From: "Lance" <[EMAIL PROTECTED]>

> Though I'm not a user of either, I'm wondering how dom4j
> compares to Castor XML (www.castor.org).

Apples and Oranges I'm afraid.

The Castor project is a good XML <-> Java Data binding technology. It takes
the approach that you write an XML Schema, then use the Castor compiler to
generate Java objects from the XML Schema which are then created when you
parse XML documents of the schema.

So its a kind of XML <-> Java data binding. It hides the XML behind a set of
Java classes which are based on a particular schema. You can also use it as
a kind of Java <-> XML mapping technology where you can map how Java objects
bind to XML schema documents.

dom4j is a general XML API for parsing & working with any XML document. You
can parse, navigate & work with any document, whether XML schema based or
not. You can use XPath expressions to navigate any document, and pass
documents into DOM, SAX, text based files or into XSLT engines via the JAXP
API.

Both have their own strengths and weaknesses.
In general with XML and Java there are 3 main approaches.

    a) read the XML into some data structure, dom4j, DOM, JDOM, Electric or
whatever
    b) use some mapping technlogy to bind the XML Schema document into some
Java beans
    c) write your own SAX based parsing code

I find myself using a) most of the time - I tend to get things done quicker
with dom4j so its the first tool I turn to when I need to read, write,
navigate or process XML.

If ever I find myself parsing the same XML schema document alot and the
schema document was quite fixed and I had enough time I'd consider using
Castor for this purpose. Though this rarely happens, there's usually
something else more important to do instead ;-)

So if, say, you wanted to design your business objects in an XML Schema
document, then Castor would be a great tool to use. It would generate Java
Beans that map to your business objects and can bind them to XML and SQL
too.

James


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


_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to