use of org.camunda.bpm.model.xml.impl.instance.DomDocumentImpl in project camunda-xml-model by camunda.
the class DomUtil method parseInputStream.
/**
* Create a new DOM document from the input stream
*
* @param documentBuilderFactory the factory to build to DOM document
* @param inputStream the input stream to parse
* @return the new DOM document
* @throws ModelParseException if a parsing or IO error is triggered
*/
public static DomDocument parseInputStream(DocumentBuilderFactory documentBuilderFactory, InputStream inputStream) {
try {
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
documentBuilder.setErrorHandler(new DomErrorHandler());
return new DomDocumentImpl(documentBuilder.parse(inputStream));
} catch (ParserConfigurationException e) {
throw new ModelParseException("ParserConfigurationException while parsing input stream", e);
} catch (SAXException e) {
throw new ModelParseException("SAXException while parsing input stream", e);
} catch (IOException e) {
throw new ModelParseException("IOException while parsing input stream", e);
}
}
Aggregations