JAXB
   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 Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable ...
representations. JAXB provides two main features: the ability to ''marshal'' Java
object Object may refer to: General meanings * Object (philosophy), a thing, being, or concept ** Object (abstract), an object which does not exist at any particular time or place ** Physical object, an identifiable collection of matter * Goal, an ...
s 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 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 by XML itself. These constra ...
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 (formerly Java EE), part of the
Java Web Services Development Pack The Java Web Services Development Pack (JWSDP) is a free software development kit (SDK) for developing Web Services, Web applications and Java applications with the newest technologies for Java. Oracle replaced JWSDP with GlassFish. All component ...
(JWSDP), and one of the foundations for WSIT. It was also part of the
Java SE Java Platform, Standard Edition (Java SE) is a computing platform for development and deployment of portable code for desktop and server environments. Java SE was formerly known as Java 2 Platform, Standard Edition (J2SE). The platform uses Ja ...
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 The Java Community Process (JCP), established in 1998, is a formalized mechanism that allows interested parties to develop standard technical specifications for Java technology. Anyone can become a JCP Member by filling a form available at thJCP w ...
as JSR 31. In 2006 JAXB 2.0 was released under JSR 222 and Maintenance Release 2 released in December 2009.
Reference implementation In the software development process, a reference implementation (or, less frequently, sample implementation or model implementation) is a program that implements all requirements from a corresponding specification. The reference implementation o ...
s for these specifications were available under the CDDL open source license at
java.net java.net was a Java technology related community website. It also offered a web-based source code repository for Java projects. It was shut down in April 2017. History java.net was announced by Sun Microsystems during JavaOne 2003. In Januar ...
.


Usage

The tool "" can be used to convert
XML Schema An XML schema is a description of a type of 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 by XML itself. These constra ...
and other schema file types (as of Java 1.6,
RELAX NG In computing, RELAX NG (REgular LAnguage for XML Next Generation) is a schema language for XML—a RELAX NG schema specifies a pattern for the structure and content of an XML document. A RELAX NG schema is itself an XML document but RELAX NG also ...
, XML DTD, and
WSDL The Web Services Description Language (WSDL ) is an XML-based interface description language that is used for describing the functionality offered by a web service. The acronym is also used for any specific WSDL description of a web service (also ...
are supported experimentally) to class representations. Classes are marked up using
annotations An annotation is extra information associated with a particular point in a document or other piece of information. It can be a note that includes a comment or explanation. Annotations are sometimes presented in the margin of book pages. For anno ...
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 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 by XML itself. These constra ...
(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 da ...
*
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 Plain ...
– one of the fastest XML data binders *
XMLBeans XMLBeans is a Java-to- XML binding framework which is part of the Apache Software Foundation XML project. Description XMLBeans is a tool that allows access to the full power of XML in a Java friendly way. The idea is to take advantage of the richn ...
– a similar and complementary technology to
JAXB Java XML Binding (JAXB; formerly Java Architecture for XML Binding) is a software framework that allows Jakarta EE, Java EE developers to map Java class (computer science), classes to XML representations. JAXB provides two main features: the abi ...
from Apache Software Foundation *
TopLink Oracle TopLink is a mapping and persistence framework for Java developers. TopLink is produced by Oracle and is a part of Oracle's OracleAS, WebLogic, and OC4J servers. It is an object-persistence and object-transformation framework. TopLink p ...
– an object to relational and object to
XML Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable ...
mapper from Oracle that supports JAXB 1.0 *
EclipseLink EclipseLink is the open source Eclipse Persistence Services Project from the Eclipse Foundation. The software provides an extensible framework that allows Java developers to interact with various data services, including databases, web services, ...
MOXy – open source 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 suppo ...
*
Liquid XML Studio Liquid XML Studio IDE is a Windows based XML editor and XML data binding toolkit. It includes graphical editors for authoring XML, XML Schema, WSDL, XSLT and HTML. It also includes user interface extension to Microsoft Visual Studio through the ...
– 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 GlassFish is an open-source Jakarta EE platform application server project started by Sun Microsystems, then sponsored by Oracle Corporation, and now living at the Eclipse Foundation and supported by Payara, Oracle and Red Hat. The supported v ...

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