This post explains some of the frequently used JAXB2 annotations. For the complete list of JAXB2 annotations, please visit API Page. Let’s quickly have a look of the mapped class, and the XML it will generate, then we will go through annotations, one at a time. Mapped Class Adapter class used in Mapped Class Generated…
Continue readingJaxb
JAXB2 Code Generation Maven Example
This post demonstrates JAXB2 Code generation example using maven-jaxb2-plugin, adding generated code to source with build-helper-maven-plugin. Sometimes, while integrating with third party software, we only get XSD’s as input. In such situations, we are responsible to generate the actual JAXB2 compliant Java code which can then be used on client side to perform integration with…
Continue readingJAXB2 Schema Validation Example
This post shown how JAXB2 Schema validation can be used in your project, validating the generated XML against specific XML Schema Definition [XSD]. An XML Schema Definition describes the structure of an XML document and governs the rules and constraints being applied on XML content. JAXB2 provides API to validate the generated XML against an…
Continue readingJAXB2 Helloworld Example,Marshal/UnMarshal Example
This JAXB2 Helloworld example post explains the basics of JAXB along with core concepts like Mapping, Marshalling & Unmarshalling XML to Java objects and vice versa, commonly used JAXB annotations, JAXBContext setup and API usage, XmlAdapter usage etc. Let’s go through them one by one: 1) Mapping Mapping refers to binding Java objects to XML…
Continue reading