HOME

TheInfoList



OR:

Java XML Binding (JAXB; formerly Java Architecture for XML Binding) is a software framework that allows Java EE 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. It is similar to xsd.exe and XmlSerializer in the
.NET Framework The .NET Framework (pronounced as "''dot net"'') is a proprietary software framework developed by Microsoft that runs primarily on Microsoft Windows. It was the predominant implementation of the Common Language Infrastructure (CLI) until bein ...
. JAXB is particularly useful when the specification is complex and changing. In such a case, regularly changing the
XML Schema An XML schema is a description of a type of Extensible Markup Language, XML document, typically expressed in terms of constraints on the structure and content of documents of that type, above and beyond the basic syntactical constraints imposed ...
definitions to keep them synchronised with the Java definitions can be time consuming and error-prone. JAXB is one of the
APIs Apis or APIS may refer to: * Apis (deity), an ancient Egyptian god * Apis (Greek mythology), several different figures in Greek mythology * Apis (city), an ancient seaport town on the northern coast of Africa **Kom el-Hisn, a different Egyptian ci ...
in the Java EE platform (formerly Java EE), part of the Java Web Services Development Pack (JWSDP), and one of the foundations for
WSIT Web Services Interoperability Technology (WSIT) is an open-source project started by Sun Microsystems to develop the next-generation of Web service technologies. It provides interoperability between Java Web Services and Microsoft's Windows Commu ...
. It was also part of the Java SE platform (in version Java SE 6-10). As of Java SE 11, JAXB was removed. For details, se
JEP 320
JAXB 1.0 was released in 2003, having been developed under the Java Community Process as JSR 31. In 2006 JAXB 2.0 was released under JSR 222 and Maintenance Release 2 released in December 2009. Reference implementations for these specifications were available under the CDDL open source license at java.net.


Usage

The tool "" can be used to convert
XML Schema An XML schema is a description of a type of Extensible Markup Language, XML document, typically expressed in terms of constraints on the structure and content of documents of that type, above and beyond the basic syntactical constraints imposed ...
and other schema file types (as of Java 1.6, RELAX NG, XML DTD, and WSDL are supported experimentally) to class representations. Classes are marked up using annotations from namespace, for example, and . XML list sequences are represented by attributes of type . Marshallers and Unmarshallers are created through an instance of JAXBContext. In addition, JAXB includes a "" tool that can essentially perform the inverse of "", creating an XML Schema from a set of annotated classes.


Default data type bindings

The table below lists the mappings of
XML Schema An XML schema is a description of a type of Extensible Markup Language, XML document, typically expressed in terms of constraints on the structure and content of documents of that type, above and beyond the basic syntactical constraints imposed ...
(XSD) data types to Java data types in JAXB.


Versions

* Java SE 9: JAXB 2.3.0 (in module java.xml.bind; this module is marked as deprecated ) * Java SE 8: JAXB 2.2.8 * Java SE 7: JAXB 2.2.3 (JSR 222, maintenance release 2) * Java SE 6: JAXB 2.0 (JSR 222)


See also

*
XML data binding XML data binding refers to a means of representing information in an XML document as a business object in computer memory. This allows applications to access the data in the XML from the object rather than using the DOM or SAX to retrieve the ...
*
JiBX JiBX is an open-source Java framework for XML data binding. It solves the same problem as tools such as JAXB, XMLBeans and JDOM, but uses an alternate approach. It lets developers work with data from XML documents using arbitrarily defined ...
– one of the fastest XML data binders * XMLBeans – a similar and complementary technology to JAXB from Apache Software Foundation * TopLink – an object to relational and object to XML mapper from
Oracle An oracle is a person or agency considered to provide wise and insightful counsel or prophetic predictions, most notably including precognition of the future, inspired by deities. As such, it is a form of divination. Description The wor ...
that supports JAXB 1.0 * EclipseLink MOXy –
open source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
implementation of JAXB and object XML mapping services under the
Eclipse Foundation The Eclipse Foundation AISBL is an independent, Europe-based not-for-profit corporation that acts as a steward of the Eclipse open source software development community, with legal jurisdiction in the European Union. It is an organization supp ...
* Liquid XML Studio – Commercial tool for XML data binding code generation
Simple XML Serialization
– An alternative to JAXB, enabling rapid development of XML configuration and communication systems


References


External links

* Reference Implementation on Project GlassFish
previous JAXB home page

original JAXB home page

A JAXB Tutorial
by Wolfgang Laun
JSR 222
(JAXB 2.0)
JSR 31
(JAXB 1.0)

JAXB chapter of the Java EE 5 Tutorial
JAXB Wizard

JAXB Tutorials


Articles


JAXB 2.0 offers improved XML binding in Java

XML and Java technologies: Data binding, Part 2: Performance
{{DEFAULTSORT:Xml Binding Architecture Java API for XML Java specification requests