Object/XML Mapping (O/X mapping)指XML文档与Java对象之间的映射关系。
XML Marshalling(也称为XML Serialization)是指在XML文档与Java对象之间的转换过程。
将Java对象转换为XML文档,称为marshaller 。
将XML文档转换为Java对象,称为unmarshaller 。
常见的O/Xmapping API:
JAXB specification provides a way to map Java classes to XMLrepresentations,是JCP的标准之一:
JAXB RI是JAXB规范的实现。JAXB project的主要目的就是开发并维护JAXB RI,当前最新版是2014.10发布的JAXB RI 2.2.11。
此外,JAXB project还提供了如下扩展工具:
从JDK6开始,JavaArchitecture for XML Binding (JAXB) 成为JDK的组成部分:
two features of JAXB:
1. XML Schema -> Java class
JAXB provides“xjc” tool to convert XML Schema to class representations.
JAXB bindingcompiler xjc is also part of the JDK6,it is a command line tool which can beused togenerate binding classes basedon an existing XSD schema description.
2. Javaclass -> XML Schema
JAXB includes a“schemagen” tool which can create an XML Schema from a set of annotatedclasses.
参考文献:
JAXB project官网https://jaxb.java.net/