JAXB (Java Architecture for XML Binding) provides efficient and standard API and concepts to convert java object to XML and XML to Java Object. These conversion are also called as marshalling and unmarshaling as below:
Marshalling: Java Object to XML
Unmarshalling: XML to Java Object
Current Version of JAXB: 2.0
JAXB is a binding framework which provides support to mapping java fields with XML attributes and properties by annotations.
Why to use JAXB?
JAXB is required when need to deal with XML over Java platform because working on XML is not easy and you have to write code for each tags, attribute and condition etc.
By using JAXB framework make your life easy by using annotations, it’s provide annotations which customize your generated XML as per your business requirement and no need to write schema for XML.
Where JAXB Can We Use?
JAXB can we use in following cases:
- In webservices communication where one application in Java and another may be different technologies. As XML is platform and Language independent language so through JAXB convert POJO classes to XML through JAXB and call services provided by other application.
- Sometimes in distributed systems are connected through SFTP/MFTP so you can keep generated XML file there and another system will pick it.
- Most of the third party tools support XML for input/output data medium as XML, so we can use generated XML file for data transformation.
Let me know your thought on it.
Happy Learning !!!