JAXB
Java Architecture xml binding
Presented By
Kiran Gajbhiye
Comp Dept | gcoej
Introduction
• JAXB(Java Architecture for XML Binding)
• It is used to convert XML to java object and java object to XML
• JAXB is an API that gives us the power to read and write Java Objects
to and from XML documents.
• Marshalling – Convert a Java object into a XML file
• Unmarshalling – Convert XML content into a Java Object
JAXB Architecture
Implementation
• A JAXB implementation consists of the following architectural components:
 schema compiler: binds a source schema to a set of schema derived program
elements. The binding is described by an XML-based binding language.
 schema generator: maps a set of existing program elements to a derived
schema. The mapping is described by program annotations.
 binding runtime framework: provides unmarshalling (reading) and
marshalling (writing) operations for accessing, manipulating and validating
XML content using either schema-derived or existing program elements.
Steps in JAXB binding process
1. Generate classes. An XML schema is used as input to the JAXB binding compiler to generate
JAXB classes based on that schema.
2. Compile classes
3. Unmarshal. XML documents written according to the constraints in the source schema are
unmarshalled by the JAXB binding framework
4. Generate content tree The unmarshalling process generates a content tree of data objects
instantiated from the generated JAXB classes
5. Validate (optional). The unmarshalling process optionally involves validation of the source
XML documents before generating the content tree.
6. Process content. The client application can modify the XML data represented by the Java
content tree by means of interfaces generated by the binding compiler.
7. Marshal. The processed content tree is marshalled out to one or more XML output documents.
The content may be validated before marshalling.
JAXB Architecture(cont’d)
Features of JAXB 2.0
• Annotation support: JAXB 2.0 provides support to annotation so less coding is required to develop
JAXB application. The javax.xml.bind.annotation package provides classes and interfaces for JAXB 2.0
• Support for all W3C XML Schema features: it supports all the W3C schema unlike JAXB 1.0
• Additional Validation Capabilities: it provides additional validation support by JAXP 1.3
validation API.
• Small Runtime Library: it required small runtime library that JAXB 1.0
• Reduction of generated schema-derived classes: it reduces a lot of generated schema-derived
classes
Thank you !!

Java architecture for xml binding

  • 1.
    JAXB Java Architecture xmlbinding Presented By Kiran Gajbhiye Comp Dept | gcoej
  • 2.
    Introduction • JAXB(Java Architecturefor XML Binding) • It is used to convert XML to java object and java object to XML • JAXB is an API that gives us the power to read and write Java Objects to and from XML documents. • Marshalling – Convert a Java object into a XML file • Unmarshalling – Convert XML content into a Java Object
  • 3.
  • 4.
    Implementation • A JAXBimplementation consists of the following architectural components:  schema compiler: binds a source schema to a set of schema derived program elements. The binding is described by an XML-based binding language.  schema generator: maps a set of existing program elements to a derived schema. The mapping is described by program annotations.  binding runtime framework: provides unmarshalling (reading) and marshalling (writing) operations for accessing, manipulating and validating XML content using either schema-derived or existing program elements.
  • 5.
    Steps in JAXBbinding process 1. Generate classes. An XML schema is used as input to the JAXB binding compiler to generate JAXB classes based on that schema. 2. Compile classes 3. Unmarshal. XML documents written according to the constraints in the source schema are unmarshalled by the JAXB binding framework 4. Generate content tree The unmarshalling process generates a content tree of data objects instantiated from the generated JAXB classes 5. Validate (optional). The unmarshalling process optionally involves validation of the source XML documents before generating the content tree. 6. Process content. The client application can modify the XML data represented by the Java content tree by means of interfaces generated by the binding compiler. 7. Marshal. The processed content tree is marshalled out to one or more XML output documents. The content may be validated before marshalling.
  • 6.
  • 7.
    Features of JAXB2.0 • Annotation support: JAXB 2.0 provides support to annotation so less coding is required to develop JAXB application. The javax.xml.bind.annotation package provides classes and interfaces for JAXB 2.0 • Support for all W3C XML Schema features: it supports all the W3C schema unlike JAXB 1.0 • Additional Validation Capabilities: it provides additional validation support by JAXP 1.3 validation API. • Small Runtime Library: it required small runtime library that JAXB 1.0 • Reduction of generated schema-derived classes: it reduces a lot of generated schema-derived classes
  • 8.