XML has been way of communication between systems, modules or programs etc. If it is the case, there is need to have framework that eases out reading from and writing to XML format and Java plain objects. It is addressed by JAXB specification.
There are multiple ways by which to and fro transformation between XML and Plain Java objects can achieved.
- Using DOM Parser : This approch will read input XML stream and convert the in-memory tree representation of XML. XML DOM tree can be navigated through set of APIs
- Using SAX Parser : This is event based framework to navigate through XML stream. We need to provider listener implmentation for SAX events in order to read/write XML data.
- XML JAXB Annotations : Annotations can help to transform XML stream into Plain Java objects and vice-versa. Annotations are placed on properties or accessor getter methods of Plain Java classes to achieve the mapping.