|
|
|
@ -16,10 +16,7 @@ import javax.xml.transform.dom.DOMSource;
|
|
|
|
import javax.xml.validation.Schema;
|
|
|
|
import javax.xml.validation.Schema;
|
|
|
|
import javax.xml.validation.SchemaFactory;
|
|
|
|
import javax.xml.validation.SchemaFactory;
|
|
|
|
import javax.xml.validation.Validator;
|
|
|
|
import javax.xml.validation.Validator;
|
|
|
|
import java.io.ByteArrayInputStream;
|
|
|
|
import java.io.*;
|
|
|
|
import java.io.File;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import java.io.StringWriter;
|
|
|
|
|
|
|
|
import java.net.URL;
|
|
|
|
import java.net.URL;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
@ -52,6 +49,13 @@ public class XMLUtilities {
|
|
|
|
return xmlToClass(document, schemaURL, c);
|
|
|
|
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 {
|
|
|
|
public static Object xmlToClass(Document document, URL schemaURL, Class c) throws ParserConfigurationException, IOException, SAXException, JAXBException {
|
|
|
|
JAXBContext jc = JAXBContext.newInstance(c);
|
|
|
|
JAXBContext jc = JAXBContext.newInstance(c);
|
|
|
|
Unmarshaller unmarshaller = jc.createUnmarshaller();
|
|
|
|
Unmarshaller unmarshaller = jc.createUnmarshaller();
|
|
|
|
|