File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes JAXP or JAXB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "JAXP or JAXB" Watch "JAXP or JAXB" New topic


Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 10033


In what scenarios do we prefer JAXP over JAXB? I'm currently exploring on JAXB to perform a task and as far as I read through JAXB, I understand that XML processing is straight forward without the need to use SAX or DOM. Given this advantage, what is the need for JAXP?

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
There are few things that come only with advantages, and no disadvantages :-)

Having JAXB create all those objects carries a performance overhead, plus the need to have all those classes in the first place. Also, SAX code is more stable in the face of changing document structure - if you use JAXB, then your classes need to match the document, or there'll be problems.
I agree. Here's the link:
subject: JAXP or JAXB
It's not a secret anymore!