JAXB Tutorial


JAXB Tutorial

JAXB tutorial provides mechanism  to convert object into XML and XML into object. Here JAXB tutorial is designed for beginners and professionals.

The latest version of JAXB API is 2.0

jaxb tutorial

Features of JAXB

  1. Support for binding Java-to-XML, with the addition of the Annotation
  2. Support for all W3C XML Schema features
  3. Additional validation capabilities through the JAXP 1.3 validation APIs.
  4. Smaller runtime libraries.

How to convert XML to java object and vice versa

To convert XML data into java object we have to follow some steps which are given below.

  1. Create POJO class.
  2. Annotate POJO class with JAXB annotation
  3. Create the JAXBContext object
  4. Create the Marshaller or UnMarshaller objects
  5. Call the marshal or unmarshal method.
  1. Convert xml into java object using jaxb
  2. convert java object into xml using jaxb

JAXB Annotations

  1. @XmlRootElement  :   Use to annotate POJO class to define root element of XML file.
  2. @XmlAttribute         :   Use to annotate POJO class fields  to define attribute inside XML file.
  3. @XmlElement           :   Use to annotate POJO class fields  to define element inside XML file.
  4.  @XmlAccessorType : 






Full-stack web and mobile app development company Contact Us : Skype: indore.webcoder Email: info@w3sparks.com Sales: +91 8085506229