fbpx
Wikipedia

Jakarta XML Binding

Jakarta 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.

Jakarta XML Binding
Repository
  • github.com/eclipse-ee4j/jaxb-ri
Written inJava
Websiteprojects.eclipse.org/projects/ee4j.jaxb-impl

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 (formerly Java EE), part of the Java Web Services Development Pack (JWSDP), and one of the foundations for 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 JEP 320.

JAXB 1.0 was released in 2003, having been developed under the Java Community Process as JSR 31.[1] In 2006 JAXB 2.0 was released under JSR 222 and Maintenance Release 2 released in December 2009.[2] Reference implementations for these specifications were 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, XML DTD, and WSDL are supported experimentally) to class representations.[3] 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 that 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 Schema (XSD) data types to Java data types in JAXB.[4]

XML Schema Type Java Data Type
xsd:string java.lang.String
xsd:integer java.math.BigInteger
xsd:positiveInteger java.math.BigInteger
xsd:int int
xsd:long long
xsd:short short
xsd:decimal java.math.BigDecimal
xsd:float float
xsd:double double
xsd:boolean boolean
xsd:byte byte
xsd:QName javax.xml.namespace.QName
xsd:dateTime javax.xml.datatype.XMLGregorianCalendar
xsd:base64Binary byte[]
xsd:hexBinary byte[]
xsd:unsignedInt long
xsd:unsignedShort int
xsd:unsignedByte short
xsd:unsignedLong java.math.BigDecimal
xsd:time javax.xml.datatype.XMLGregorianCalendar
xsd:date javax.xml.datatype.XMLGregorianCalendar
xsd:g javax.xml.datatype.XMLGregorianCalendar
xsd:anySimpleType[5] java.lang.Object
xsd:anySimpleType[6] java.lang.String
xsd:duration javax.xml.datatype.Duration
xsd:NOTATION javax.xml.namespace.QName

Versions

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

See also

References

  1. ^ "JSRs: Java Specification Requests. JSR 31: XML Data Binding Specification". Retrieved 2011-02-15.
  2. ^ "JSRs: Java Specification Requests. JSR 222: Java Architecture for XML Binding (JAXB) 2.0". Retrieved 2011-02-15.
  3. ^ "xjc - Java Architecture for XML Binding". Retrieved 2011-02-15.
  4. ^ "Using JAXB Data Binding: Standard Data Type Mapping".
  5. ^ for xsd:element of this type
  6. ^ for xsd:attribute of this type
  7. ^ "Which JAXB RI is included in which JDK?".
  8. ^ "Deprecated module java.xml.bind".
  9. ^ "Jaxb 2.2.8 (JDK 8)". Retrieved 2015-03-01.
  10. ^ "Java SE 7: Java XML Technology Enhancements". Retrieved 2012-03-21.
  11. ^ "Java SE 6: Features and Enhancements". Retrieved 2012-03-21.
  12. ^ Dennis Sosnoski. "XML and Java technologies: Data binding, Part 2: Performance". Retrieved 2011-02-15.
  13. ^ . Archived from the original on 2011-07-16. Retrieved 2011-02-15.

External links

  • Official website   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)
  • The Java EE 5 Tutorial - Binding between XML Schema and Java Classes JAXB chapter of the Java EE 5 Tutorial
  • JAXB Wizard 2012-05-31 at the Wayback Machine

Articles

  • JAXB 2.0 offers improved XML binding in Java
  • XML and Java technologies: Data binding, Part 2: Performance

jakarta, binding, jaxb, formerly, java, architecture, binding, software, framework, that, allows, java, developers, java, classes, representations, jaxb, provides, main, features, ability, marshal, java, objects, into, inverse, unmarshal, back, into, java, obj. Jakarta 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 Jakarta XML BindingRepositorygithub wbr com wbr eclipse ee4j wbr jaxb riWritten inJavaWebsiteprojects wbr eclipse wbr org wbr projects wbr ee4j wbr jaxb implJAXB 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 formerly Java EE part of the Java Web Services Development Pack JWSDP and one of the foundations for 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 JEP 320 JAXB 1 0 was released in 2003 having been developed under the Java Community Process as JSR 31 1 In 2006 JAXB 2 0 was released under JSR 222 and Maintenance Release 2 released in December 2009 2 Reference implementations for these specifications were available under the CDDL open source license at java net Contents 1 Usage 2 Default data type bindings 3 Versions 4 See also 5 References 6 External links 6 1 ArticlesUsage EditThe tool xjc can be used to convert XML Schema and other schema file types as of Java 1 6 RELAX NG XML DTD and WSDL are supported experimentally to class representations 3 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 that can essentially perform the inverse of xjc creating an XML Schema from a set of annotated classes Default data type bindings EditThe table below lists the mappings of XML Schema XSD data types to Java data types in JAXB 4 XML Schema Type Java Data Typexsd string java lang Stringxsd integer java math BigIntegerxsd positiveInteger java math BigIntegerxsd int b int b xsd long b long b xsd short b short b xsd decimal java math BigDecimalxsd float b float b xsd double b double b xsd boolean b boolean b xsd byte b byte b xsd QName javax xml namespace QNamexsd dateTime javax xml datatype XMLGregorianCalendarxsd base64Binary b byte b xsd hexBinary b byte b xsd unsignedInt b long b xsd unsignedShort b int b xsd unsignedByte b short b xsd unsignedLong java math BigDecimalxsd time javax xml datatype XMLGregorianCalendarxsd date javax xml datatype XMLGregorianCalendarxsd g javax xml datatype XMLGregorianCalendarxsd anySimpleType 5 java lang Objectxsd anySimpleType 6 java lang Stringxsd duration javax xml datatype Durationxsd NOTATION javax xml namespace QNameVersions EditJava SE 9 JAXB 2 3 0 7 in module java xml bind this module is marked as deprecated 8 Java SE 8 JAXB 2 2 8 9 Java SE 7 JAXB 2 2 3 JSR 222 maintenance release 2 10 Java SE 6 JAXB 2 0 JSR 222 11 See also EditXML data binding JiBX one of the fastest XML data binders 12 13 XMLBeans a similar and complementary technology to JAXB from Apache Software Foundation TopLink an object to relational and object to XML mapper from 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 Simple XML Serialization An alternative to JAXB enabling rapid development of XML configuration and communication systemsReferences Edit JSRs Java Specification Requests JSR 31 XML Data Binding Specification Retrieved 2011 02 15 JSRs Java Specification Requests JSR 222 Java Architecture for XML Binding JAXB 2 0 Retrieved 2011 02 15 xjc Java Architecture for XML Binding Retrieved 2011 02 15 Using JAXB Data Binding Standard Data Type Mapping for xsd element of this type for xsd attribute of this type Which JAXB RI is included in which JDK Deprecated module java xml bind Jaxb 2 2 8 JDK 8 Retrieved 2015 03 01 Java SE 7 Java XML Technology Enhancements Retrieved 2012 03 21 Java SE 6 Features and Enhancements Retrieved 2012 03 21 Dennis Sosnoski XML and Java technologies Data binding Part 2 Performance Retrieved 2011 02 15 XML Binding Frameworks in the Context of Service Oriented Architecture Archived from the original on 2011 07 16 Retrieved 2011 02 15 External links EditOfficial website 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 The Java EE 5 Tutorial Binding between XML Schema and Java Classes JAXB chapter of the Java EE 5 Tutorial JAXB Wizard Archived 2012 05 31 at the Wayback Machine JAXB TutorialsArticles Edit JAXB 2 0 offers improved XML binding in Java XML and Java technologies Data binding Part 2 Performance Retrieved from https en wikipedia org w index php title Jakarta XML Binding amp oldid 1143292950, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.