JAXB Java Architecture for XML Binding Andy Fanton

JAXB Java Architecture for XML Binding Andy Fanton Khalid Al. Bayat

Outline What is JAXB? Benefits of JAXB Implementation Components Goals of JAXB Binding Process Demo

JAXB Overview JAXB provides an easy way to bind XML schemas to Java representations. JAXB makes it easy to incorporate XML functions into Java applications without having to know much about the particulars of XML. The binding framework facilitates the unmarshalling of XML documents into Java content trees and vice versa.

General JAXB Overview

Isolating the Binding from the Implementation process provides some benefits: The size of the JAXB binding implementation is small and efficient as compared to SAX and DOM. One could focus on writing schemas and generating JAXB packages which could be shared among different applications. JAXB bindings can be customized to suit the users’ particular needs e. g. customizing package, interface or property names.

Goals of JAXB Makes it easier to use Java applications to read, process and output XML data. Provides flexible, extensible, platformneutral formats and protocols for structuring and exchanging information. Easy to access and modify XML documents within Java programs. Ability to customize the binding of existing schema to Java representations

Goals and Uses of JAXB… Portability &Provide clean “round-tripping”. Access configuration values from a properties file stored in XML format. Create tools to manipulate configuration properties file represented in XML format. Update data received in the form of XML document without having to write SAX event handlers.

Core JAXB Components

Core Components of JAXB Implementation • • XML Schema Binding Declarations Binding Compiler Binding Framework Implementation Schema-Derived Classes Java Application XML Input Documents XML Output Documents

JAXB Binding Process

Steps in the JAXB Binding Process Generate Classes Compile Classes Unmarshal Generate Content Tree Validate (Optional) Process Content Marshal
- Slides: 11