Jan 20, 2014

JAXB Interview Questions and Answers -- power of MOXy

Q. Why would be the motivating factor to use MOXy implementation of JAXB as opposed to the default implementation provided by the JDK6 implementation?

A. Using the @XmlPath annotation and other extensions provided by MOXy will make your implementation cleaner. For example. if we were to implement the previous example with some dependency class like Department, you need to define the Department POJO as follows to work with Default JDK implementation

Step 3: You will only need Employee.java and Department.java will no longer required. Thanks to the power of annotation @XmlPath("faculty/name/text( )"). Here is the revised Employee.java unmarshalling the same XML file with within employee.