Java tutorial
//package com.java2s; import java.io.File; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; public class Main { public static Object xmlToPojo(Object o, String arquivo) throws JAXBException { File file = new File(arquivo); JAXBContext jaxbContext = JAXBContext.newInstance(o.getClass()); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); return jaxbUnmarshaller.unmarshal(file); } }