Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Jakarta XML Binding
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Java EE software framework}} {{Infobox software |website = {{Official URL}} |programming language = [[Java (programming language)|Java]]}} '''Jakarta 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)|class]]es to [[XML]] representations. JAXB provides two main features: the ability to [[marshalling (computer science)|''marshal'']] Java [[object (computer science)|object]]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 <code>xsd.exe</code> and <code>XmlSerializer</code> in the [[.NET Framework]]. JAXB is particularly useful when the specification is complex and changing. In such a case, regularly changing the [[XML Schema (W3C)|XML Schema]] definitions to keep them synchronised with the Java definitions can be time-consuming and error-prone. JAXB is one of the [[application programming interface|APIs]] in the Jakarta EE platform (formerly Java EE), part of the [[Java Web Services Development Pack]] (JWSDP), and one of the foundations for [[Web Services Interoperability Technology|WSIT]]. 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, see [http://openjdk.java.net/jeps/320 JEP 320]. JAXB 1.0 was released in 2003, having been developed under the [[Java Community Process]] as JSR 31.<ref>{{cite web |url=http://jcp.org/en/jsr/detail?id=031 |title=JSRs: Java Specification Requests. JSR 31: XML Data Binding Specification |access-date=2011-02-15}}</ref> In 2006 JAXB 2.0 was released under JSR 222 and Maintenance Release 2 released in December 2009.<ref>{{cite web |url=http://jcp.org/en/jsr/detail?id=222 |title=JSRs: Java Specification Requests. JSR 222: Java Architecture for XML Binding (JAXB) 2.0 |access-date=2011-02-15}}</ref> [[Reference implementation]]s for these specifications were available under the [[CDDL|CDDL open source license]] at [[java.net]]. == Usage == The tool "{{mono|xjc}}" can be used to convert [[XML Schema (W3C)|XML Schema]] and other schema file types (as of Java 1.6, [[RELAX NG]], XML [[Document Type Definition|DTD]], and [[Web Services Description Language|WSDL]] are supported experimentally) to class representations.<ref>{{cite web |url=http://download.oracle.com/javase/6/docs/technotes/tools/share/xjc.html |title=xjc - Java Architecture for XML Binding |access-date=2011-02-15}}</ref> Classes are marked up using [[Java annotation|annotations]] from {{mono|javax.xml.bind.annotation.*}} namespace, for example, {{mono|@XmlRootElement}} and {{mono|@XmlElement}}. XML list sequences are represented by attributes of type {{mono|java.util.List}}. Marshallers and Unmarshallers are created through an instance of JAXBContext. In addition, JAXB includes a "{{mono|schemagen}}" tool that can essentially perform the inverse of "{{mono|xjc}}", creating an XML Schema from a set of annotated classes. == Default data type bindings == The table below lists the mappings of [[XML Schema (W3C)|XML Schema]] (XSD) data types to Java data types in JAXB.<ref> {{cite web | url = http://download.oracle.com/docs/cd/E12840_01/wls/docs103/webserv/data_types.html#wp223908 | title = Using JAXB Data Binding: Standard Data Type Mapping }} </ref> {| class="wikitable sortable" style="font-size: 100%; text-align: left; width: 35%;" |- ! XML Schema Type ! Java Data Type |- |<code>xsd:string</code> |<code>java.lang.String</code> |- |<code>xsd:integer</code> |<code>java.math.BigInteger</code> |- |<code>xsd:positiveInteger</code> |<code>java.math.BigInteger</code> |- |<code>xsd:int</code> |<code>'''int'''</code> |- |<code>xsd:long</code> |<code>'''long'''</code> |- |<code>xsd:short</code> |<code>'''short'''</code> |- |<code>xsd:decimal</code> |<code>java.math.BigDecimal</code> |- |<code>xsd:float</code> |<code>'''float'''</code> |- |<code>xsd:double</code> |<code>'''double'''</code> |- |<code>xsd:boolean</code> |<code>'''boolean'''</code> |- |<code>xsd:byte</code> |<code>'''byte'''</code> |- |<code>xsd:QName</code> |<code>javax.xml.namespace.QName</code> |- |<code>xsd:dateTime</code> |<code>javax.xml.datatype.XMLGregorianCalendar</code> |- |<code>xsd:base64Binary</code> |<code>'''byte[]'''</code> |- |<code>xsd:hexBinary</code> |<code>'''byte[]'''</code> |- |<code>xsd:unsignedInt</code> |<code>'''long'''</code> |- |<code>xsd:unsignedShort</code> |<code>'''int'''</code> |- |<code>xsd:unsignedByte</code> |<code>'''short'''</code> |- |<code>xsd:unsignedLong</code> |<code>java.math.BigDecimal</code> |- |<code>xsd:time</code> |<code>javax.xml.datatype.XMLGregorianCalendar</code> |- |<code>xsd:date</code> |<code>javax.xml.datatype.XMLGregorianCalendar</code> |- |<code>xsd:g</code> |<code>javax.xml.datatype.XMLGregorianCalendar</code> |- |<code>xsd:anySimpleType</code><ref>for <code>xsd:element</code> of this type</ref> |<code>java.lang.Object</code> |- |<code>xsd:anySimpleType</code><ref>for <code>xsd:attribute</code> of this type</ref> |<code>java.lang.String</code> |- |<code>xsd:duration</code> |<code>javax.xml.datatype.Duration</code> |- |<code>xsd:NOTATION</code> |<code>javax.xml.namespace.QName</code> |- |} ==Versions== * Java SE 9: JAXB 2.3.0 <ref>{{cite web |url=https://javaee.github.io/jaxb-v2/doc/user-guide/release-documentation.html#deployment-which-jaxb-ri-is-included-in-which-jdk |title=Which JAXB RI is included in which JDK?}}</ref> (in module <code>java.xml.bind</code>; this module is marked as deprecated <ref>{{cite web |url=https://docs.oracle.com/javase/9/docs/api/java.xml.bind-summary.html |title=Deprecated module java.xml.bind}}</ref>) * Java SE 8: JAXB 2.2.8 <ref>{{cite web |url=https://java.net/jira/browse/JAXB/fixforversion/16521 |archive-url=https://web.archive.org/web/20150512171511/https://java.net/jira/browse/JAXB/fixforversion/16521 |url-status=dead |archive-date=May 12, 2015 |title=Jaxb 2.2.8 (JDK 8) |access-date=2015-03-01 }}</ref> * Java SE 7: JAXB 2.2.3 (JSR 222, maintenance release 2) <ref>{{cite web |url=http://docs.oracle.com/javase/7/docs/technotes/guides/xml/enhancements.html |title=Java SE 7: Java XML Technology Enhancements | access-date=2012-03-21}}</ref> * Java SE 6: JAXB 2.0 (JSR 222) <ref>{{cite web |url=http://www.oracle.com/technetwork/java/javase/features-141434.html |title=Java SE 6: Features and Enhancements | access-date=2012-03-21}}</ref> ==See also== * [[XML data binding]] * [[JiBX]] * [[XMLBeans]] – a similar and complementary technology to [[JAXB]] from [[Apache Software Foundation]] * [[TopLink]] – an object to relational and object to [[XML]] mapper from [[Oracle Corporation|Oracle]] that supports JAXB 1.0 * [[EclipseLink]] MOXy – [[open source]] implementation of JAXB and object XML mapping services under the [[Eclipse Foundation]] * [[Liquid XML Studio]] β Commercial tool for XML data binding code generation ==References== {{reflist|2}} ==External links== * {{Official website}} Reference Implementation on Project [[GlassFish]] * [http://jaxb.java.net/ Previous JAXB home page] {{Webarchive|url=https://web.archive.org/web/20170504080640/http://jaxb.java.net/ |date=2017-05-04 }} * Original JAXB home page {{Webarchive|url=https://web.archive.org/web/20050709030508/http://java.sun.com/xml/jaxb/index.jsp |date=2005-07-09 }} * [http://jaxb.java.net/tutorial/ A JAXB Tutorial] {{Webarchive|url=https://web.archive.org/web/20130323015034/http://jaxb.java.net/tutorial/ |date=2013-03-23 }} by Wolfgang Laun * [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://docs.oracle.com/javaee/5/tutorial/doc/bnazf.html The Java EE 5 Tutorial - Binding between XML Schema and Java Classes] JAXB chapter of the Java EE 5 Tutorial * [http://wiki.netbeans.org/JAXBWizard JAXB Wizard] {{Webarchive|url=https://web.archive.org/web/20120531145542/http://wiki.netbeans.org/JAXBWizard |date=2012-05-31 }} * [https://web.archive.org/web/20150128144039/http://memorynotfound.com/category/java/xml/jax-b/ JAXB Tutorials] ===Articles=== * [http://www.techrepublic.com/blog/software-engineer/jaxb-20-offers-improved-xml-binding-in-java/ JAXB 2.0 offers improved XML binding in Java] * [http://ibm.co/2kt0SvB XML and Java technologies: Data binding, Part 2: Performance] {{Jakarta EE}} {{DEFAULTSORT:Xml Binding Architecture}} [[Category:Java API for XML]] [[Category:Java specification requests]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cite web
(
edit
)
Template:Infobox software
(
edit
)
Template:Jakarta EE
(
edit
)
Template:Mono
(
edit
)
Template:Official website
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Webarchive
(
edit
)