use of org.pentaho.platform.plugin.services.importer.mimeType.bindings.ImportHandlerMimeTypeDefinitionsDto in project pentaho-platform by pentaho.
the class MimeTypeListFactory method fromXml.
private ImportHandlerMimeTypeDefinitionsDto fromXml(FileInputStream input) throws JAXBException {
SAXParserFactory secureSAXParserFactory;
try {
secureSAXParserFactory = XMLParserFactoryProducer.createSecureSAXParserFactory();
} catch (SAXNotSupportedException | SAXNotRecognizedException | ParserConfigurationException ex) {
throw new JAXBException(ex);
}
XMLReader xmlReader;
try {
xmlReader = secureSAXParserFactory.newSAXParser().getXMLReader();
xmlReader.setFeature("http://xml.org/sax/features/namespaces", true);
} catch (SAXException | ParserConfigurationException ex) {
throw new JAXBException(ex);
}
Source xmlSource = new SAXSource(xmlReader, new InputSource(input));
JAXBContext jc = JAXBContext.newInstance("org.pentaho.platform.plugin.services.importer.mimeType.bindings");
Unmarshaller u = jc.createUnmarshaller();
JAXBElement<ImportHandlerMimeTypeDefinitionsDto> o = (JAXBElement) (u.unmarshal(xmlSource));
ImportHandlerMimeTypeDefinitionsDto mimeTypeDefinitions = o.getValue();
return mimeTypeDefinitions;
}
Aggregations