package eu.eudat.logic.utilities.documents.xml.datasetProfileXml; import eu.eudat.logic.utilities.documents.xml.datasetProfileXml.datasetProfileModel.DatasetProfile; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; import java.io.*; public class ImportXmlBuilderDatasetProfile { public DatasetProfile build(File xmlFile) throws IOException { DatasetProfile datasetProfile = new DatasetProfile(); JAXBContext jaxbContext = null; try { jaxbContext = JAXBContext.newInstance(DatasetProfile.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); datasetProfile = (DatasetProfile) unmarshaller.unmarshal(xmlFile); } catch (JAXBException e) { e.printStackTrace(); } return datasetProfile; } }