130 likes | 330 Views
JAXB Java Architecture for XML Binding. Andy Fanton Khalid AlBayat. Outline. What is JAXB? Benefits of JAXB JAXB Implementation Components Goals of JAXB JAXB Binding Process Demo. JAXB Overview. JAXB provides an easy way to bind XML schemas to Java representations.
E N D
JAXBJava Architecture for XML Binding Andy Fanton Khalid AlBayat
Outline • What is JAXB? • Benefits of JAXB • JAXB Implementation Components • Goals of JAXB • 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.
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, platform-neutral 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 Components of JAXB Implementation • XML Schema • Binding Declarations • Binding Compiler • Binding Framework Implementation • Schema-Derived Classes • Java Application • XML Input Documents • XML Output Documents
Steps in the JAXB Binding Process • Generate Classes • Compile Classes • Unmarshal • Generate Content Tree • Validate (Optional) • Process Content • Marshal