Fixed issue using File from java.io.File which did not like maven

This commit is contained in:
Fan-Wu Yang
2017-08-17 16:24:54 +12:00
parent d2f9bfedcb
commit 83b0c0a6b4
3 changed files with 10 additions and 5 deletions
@@ -16,10 +16,7 @@ import javax.xml.transform.dom.DOMSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
import java.io.*;
import java.net.URL;
/**
@@ -52,6 +49,13 @@ public class XMLUtilities {
return xmlToClass(document, schemaURL, c);
}
public static Object xmlToClass(InputStream i, URL schemaURL, Class c) throws ParserConfigurationException, IOException, SAXException, JAXBException {
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = parser.parse(i);
return xmlToClass(document, schemaURL, c);
}
public static Object xmlToClass(Document document, URL schemaURL, Class c) throws ParserConfigurationException, IOException, SAXException, JAXBException {
JAXBContext jc = JAXBContext.newInstance(c);
Unmarshaller unmarshaller = jc.createUnmarshaller();