File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes JAXP and JAXB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "JAXP and JAXB" Watch "JAXP and JAXB" New topic
Author

JAXP and JAXB

Silvio Esser
Ranch Hand

Joined: Nov 05, 2005
Posts: 58
When should we use JAXB or JAXP? I saw some overlap on them.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42360
    
  64
A quick search of the XML forum discovers that this has recently been discussed.
[ January 26, 2006: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
Silvio Esser
Ranch Hand

Joined: Nov 05, 2005
Posts: 58
Thanks for the info.

If I need to create a XML document, I can use JAXP(DOM) or JAXB. But which way is the best?
Reid M. Pinchback
Ranch Hand

Joined: Jan 25, 2002
Posts: 775
If you aren't currently using or willing to start using XMLSchema to define an XSD for your documents, then you can ignore JAXB. Nothing wrong with JAXB, just that it is intended to fit into the XMLSchema tools space, not the DTD tools space.


Reid - SCJP2 (April 2002)
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18708
    
    8

Originally posted by Silvio Esser:
If I need to create a XML document, I can use JAXP(DOM) or JAXB. But which way is the best?
That depends entirely on where the data for the XML document comes from, and what you plan to do with the XML document.

If you have a Java object and you want to convert it into XML, and subsequently convert back into the same object, then use JAXB. If you have data in a database (for example) and you want to make it into XML, then use one of the JAXP technologies. As usual in the computing business there is no such thing as "best". Spend some time learning about the various XML technologies and you will not find it necessary to ask questions like this one. Specific questions are much easier to answer.
Silvio Esser
Ranch Hand

Joined: Nov 05, 2005
Posts: 58
I may call it "better" instead of "best".

Thanks for the inputs. I agree with you that there are just too many
frameworks or tools out there that do a little helps, but more confusions.
I know BEA has xBean does the same thing as JAXB.
[ January 26, 2006: Message edited by: Silvio Esser ]
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12809
    
    5
You might browse the last couple of weeks of posts in this forum. As I recall, a variety of XML creation problems have been discussed recently, with many different solutions proposed.
Bill
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: JAXP and JAXB