JAXB stands for Java Architecture for XML Bindings. In a nutshell, JAXB used for convert Java Object to XML and vice versa. We called it marshalling to convert Java object to XML and unmarshalling to convert XML to Java object. JAXB bundled in Java 1.6++, so we do not need another external libraries (but sometimes I loved to adding testing and logging framework). First, you have to know the technology that I used in this tutorial are :
- Maven 3
- TestNG (for unit test)
- commons-io
Some of you would frown and said “hmm, why you put commons-io on this tutorial?”. Simple, I used it in unit-test to get xml file from resource folder and convert to String, I know it can be done with the classic inputstream ways. but remember to not reinventing the wheel :)