aspose file tools*
The moose likes Web Services and the fly likes why JAXB ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "why JAXB ?" Watch "why JAXB ?" New topic
Author

why JAXB ?

Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
I am learning JAXB, I know it could convert data between java and XML. But in real world, what is usage for this API ?

1. Why will we need to convert java to XML ? storage ? No, we could directly save data into relational database.

2. Why will we need to convert XML to java ? In J2EE, if we have XML data, then we could directly generate page using JSTL xml tag.

I don't know if the higher level API, like Hibernate, is using JAXB ? Or java web service is using it in the lower level. Maybe this is only usage. But for regular developer, JAXB has nothing usage.

If I am wrong, please correct me.

Thanks.
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874



1. Why will we need to convert java to XML ? storage ? No, we could directly save data into relational database.


XML is easily portable and can be used interoperability between systems. sometimes it can be used as common protocol to 2 different system communicate.


I know it could convert data between java and XML. But in real world, what is usage for this API ?


Well say your application receives inbound XML from various systems and you need to do some calculations and store certain values to DB. you should probably use JAXB to convert XML to java objects and retrieve the objects to perform operations and store it in DB.
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
Examples use cases:
  • Export model to XML
  • Import XML to model


  • Anyway, you don't need to use JAXB, you can use any Java-XML mapping tools.


    SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
     
    jQuery in Action, 2nd edition
     
    subject: why JAXB ?