Hi Balaji

They are both valid approaches to a similar problem and both have their own
strengths and weaknesses.

Binding XML documents to Java objects is a bit more complex and may result
in a more complex build process as you may need to code generate Java
classes. You also must maintain some 'mapping schema' of some kind. Though
on the plus side, the xml-java binding approach can lead to faster parsing.

The dom4j approach allows you to work with any XML document easily and
allows you full and powerful navigation through that document using XPath
expressions along with easy integration with SAX and XSLT. The downside of
the dom4j approach is that it is a generic XML object model, rather than a
custom Java bean model and so it may be a bit slower to parse.

So I'd say it depends on what you're doing. If you're working with arbitrary
XML documents and find easy navigation with XPath or styling with XSLT
useful, then dom4j is a good approach. If you are using a single, fairly
static XML document schema and are happy to write all the Java code to
navigate your model and you don't mind spending some extra development time
to gain some increased performance then the xml-java binding approach may be
worth considering.

I tend to recommend people start with dom4j as its easier to get going and
XPath and XSLT are really cool and powerful. Then consider moving to Castor,
JAXB, Quick or whatever else if they think XML parsing is becoming a
performance bottleneck.

James

From: "Balaji Iyer" <[EMAIL PROTECTED]>
To: "James Strachan" <[EMAIL PROTECTED]>; "Bill la Forge"
<[EMAIL PROTECTED]>; "Dane Foster" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Tuesday, June 12, 2001 11:45 AM
Subject: RE: [dom4j-user] Thread safety


Hi All,
 I am planning to use Castor apis for xml-java translation. Kindly let
me know if there is any disadvantage compared to use with DOM4J.
 For the past few days I have been testing with Castor and its  mapping
facilities etc for converting my serializable objects to xml and so and
so forth...Looks good to me.

Thanks,
rgds,
Balaji



_________________________________________________________
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