JAX-B Introduction

JAX-B it is an acronym of Java API for XML Binding. It is a convenient framework to process XML documents.
JAX-B provides a mechanism to marshal java objects into XML document and un-marshals XML document in to Java Objects.
JAX-B mainly used for three operations.which are listed below
  • Marshalling a tree of objects into an XML document
  • Unmarshalling an XML document into a tree of objects.
    1. It includes validation of the XML against the schema
    2. It used to generate the classes of the objects
  • javascript:void(0);
  • Validation of object trees against the schema used to generate their classes
    1. some constraints are enforced while working with the objects
    2. others are only enforced when validation is requested

The following diagram describes JAX-B architecture.


New features in JAXB 2.0 over JAXB 1.0
  • Parameterized types:JAX-B supports parameterized types, The advantage of parameterized types is compile time type checking.

  • JAXB 2.0 supports all of XML Schema constructs, JAXB 1.0 doesn't.
  • With JAXB 2.0 fewer Java classes are generated from an XML Schema as compared to JAXB 1.0. For each top level complexType, a value class is generated, instead of an interface and an implementation class. For each top-level element, a factory class method is generated, instead of an interface and an implementation class. Fewer runtime libraries are required for JAXB 2.0.
  • Annotation: In JAXB 2.0, support for binding Java to XML has been added with javax.xml.bind.annotation package. Annotations provide a metadata facility with which code may be generated using annotation types and annotation declarations.
  • WebSerive support: JAXB 2.0 provides integration with the Java API for XML-based Web Services (JAX-WS) 2.0.

  • References
    SHARE

      Blogger Comment
      Facebook Comment

    0 comments :

    Post a Comment