- Java Architecture for XML Binding
Java Architecture for XML Binding (JAXB) allows Java developers to map Java classes to
XML representations. JAXB provides two main features: the ability to "marshal" Java objects into XML and the inverse, i.e. to "unmarshal" XML back into Java objects. In other words, JAXB allows storing and retrieving data in memory in any XML format, without the need to implement a specific set of XML loading and saving routines for the program's class structure.JAXB is particularly useful when the specification is complex and changing. In such a case, regularly changing the XML Schema definitions to keep them synchronised with the Java definitions can be time consuming and error prone.
JAXB is one of the APIs in the Java EE platform, and is part of the
Java Web Services Development Pack (JWSDP). It is also one of the foundations for WSIT. JAXB is part of SE version 1.6.JAXB 1.0 was developed under the
Java Community Process as JSR 31.As of 2006 , JAXB 2.0 is being developed under JSR 222. Reference implementations for these specifications are available under the CDDL open source license at java.net.Usage
The tool "xjc" can be used to convert XML Schema and other schema file types (as of Java 1.6,
RELAX NG and XML DTDs are supported experimentally) to class representations. Classes are marked up using annotations from javax.xml.bind.annotation.* namespace, for example, @XmlRootElement and @XmlElement. XML list sequences are represented by attributes of type java.util.List. Marshallers and Unmarshallers are created through an instance of JAXBContext.In addition, JAXB includes a "schemagen" tool which can essentially perform the inverse of "xjc", creating an XML Schema from a set of annotated classes.
Default data type bindings
The table below lists the mappings of XML data types to Java data types in JAXB.
See also
*
XML data binding
*XMLBeans – A similar and complementary technology toJAXB fromApache Software Foundation
*TopLink – an object to relational and object toXML mapper from Oracle that supports JAXB 1.0Articles
* [http://www.devx.com/Java/Article/34069 Generate an XML Document from an Object Model with JAXB 2]
* [http://blogs.techrepublic.com.com/programming-and-development/?p=498 JAXB 2.0]External links
* [https://jaxb.dev.java.net/ JAXB home page] on Project
GlassFish
* [http://java.sun.com/xml/jaxb/index.jsp previous JAXB home page]
* [http://ws.apache.org/jaxme/ JaxMe] –Open source implementation of JAXB under theApache Software Foundation
* [http://www.eclipse.org/eclipselink/ EclipseLink MOXy] –Open Source implementation of JAXB and object XML mapping services under theEclipse Foundation
* [http://www.jcp.org/en/jsr/detail?id=222 JSR 222] (JAXB 2.0)
* [http://www.jcp.org/en/jsr/detail?id=31 JSR 31] (JAXB 1.0)
* [http://java.sun.com/javaee/5/docs/tutorial/doc/?wp405761&JAXB.html#wp100322 JAXB chapter of the Java EE 5 Tutorial]
* [http://wiki.netbeans.org/wiki/view/JAXBWizard/ JAXB Wizard]
Wikimedia Foundation. 2010.