private static WorkflowDescriptor load(InputStream is, URL url) throws SAXException, IOException, InvalidWorkflowDescriptorException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); dbf.setValidating(true);  DocumentBuilder db = null;  try { db = dbf.newDocumentBuilder(); db.setEntityResolver(new DTDEntityResolver()); } catch (ParserConfigurationException e) { log.fatal("Could not load workflow file", e); }  db.setErrorHandler(new WorkflowErrorHandler(url));  Document doc = db.parse(is);  Element root = (Element) doc.getElementsByTagName("workflow").item(0);  WorkflowDescriptor descriptor = new WorkflowDescriptor(root); descriptor.validate();  return descriptor;
public static WorkflowDescriptor load(final InputStream is) throws SAXException, IOException, InvalidWorkflowDescriptorException { return load(is, null);
    private static WorkflowDescriptor load(InputStream is, URL url) throws SAXException, IOException, InvalidWorkflowDescriptorException {        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();        dbf.setNamespaceAware(true);        dbf.setValidating(true);        DocumentBuilder db = null;        try {            db = dbf.newDocumentBuilder();            db.setEntityResolver(new DTDEntityResolver());        } catch (ParserConfigurationException e) {            log.fatal("Could not load workflow file", e);        }        db.setErrorHandler(new WorkflowErrorHandler(url));        Document doc = db.parse(is);        Element root = (Element) doc.getElementsByTagName("workflow").item(0);        WorkflowDescriptor descriptor = new WorkflowDescriptor(root);        descriptor.validate();        return descriptor;    }