Maven Jaxb Plugin
From Foochal
- Create your schema foo.xsd file.
- Setup maven pom.xml to use the jaxb plugin. Instructions here: https://jaxb.dev.java.net/jaxb-maven2-plugin/
- Convert an xml file to top level Jaxb object, which corresponds to the outermost xml tag in the schema.
javax.xml.bind.JAXBContext jc = javax.xml.bind.JAXBContext.newInstance(PACKAGE); javax.xml.bind.Unmarshaller u = jc.createUnmarshaller(); Object foo = u.unmarshal(is); return (YourTopLevelJaxbObject) foo;

