jdk中默认提供了一个JAXB(Java Architecture for XML Binding简称JAXB)允许Java开发人员将Java类映射为XML表示方式.使用起来极其的方便。
先看一下JAXB的源码注释
Class that defines convenience methods for common, simple use of JAXB.
Methods defined in this class are convenience methods that combine several basic operations in the JAXBContext, Unmarshaller, and Marshaller. They are designed to be the prefered methods for developers new to JAXB. They have the following characterstics:
Generally speaking, the performance is not necessarily optimal. It is expected that people who need to write performance critical code will use the rest of the JAXB API directly.
Errors that happen during the processing is wrapped into DataBindingException (which will have JAXBException as its cause. It is expected that people who prefer the checked exception would use the rest of the JAXB API directly.
In addition, the unmarshal methods have the following characteristic:
Sche