throw new DomLSEx(LSException.PARSE_ERR, e);
throw new DomLSException(LSException.PARSE_ERR, e);
  private Document doParse(LSInput input)    throws DOMException, LSException  {    // create event sink    if (eventSink != null)      {        throw new LSException(LSException.PARSE_ERR, "parse in progress");      }    InputSource source = getInputSource(input);    eventSink = (filter == null) ? new SAXEventSink() :      new FilteredSAXEventSink(filter);    // configure sink    eventSink.namespaceAware = namespaceAware;    eventSink.ignoreWhitespace = ignoreWhitespace;    eventSink.expandEntityReferences = expandEntityReferences;    eventSink.ignoreComments = ignoreComments;    eventSink.coalescing = coalescing;    // get and configure reader    XMLReader reader = getXMLReader();    try      {        reader.setContentHandler(eventSink);        reader.setDTDHandler(eventSink);        reader.setProperty("http://xml.org/sax/properties/lexical-handler",                           eventSink);        reader.setProperty("http://xml.org/sax/properties/declaration-handler",                           eventSink);        reader.setFeature("http://xml.org/sax/features/namespaces",                          namespaceAware);        reader.setFeature("http://xml.org/sax/features/namespace-prefixes",                          true);        reader.setFeature("http://xml.org/sax/features/validation",                          validating);        try          {            reader.setFeature("http://xml.org/sax/features/use-attributes2",                              true);          }        catch (SAXNotRecognizedException e)          {            // ignore          }        try          {            reader.setFeature("http://xml.org/sax/features/external-general-entities",                              true);          }        catch (SAXNotRecognizedException e)          {            // ignore          }        reader.setEntityResolver(entityResolver);        reader.setErrorHandler(errorHandler);        // parse        reader.parse(source);      }    catch (DOMException e)      {        reader = null;        eventSink = null;        throw e;      }    catch (SAXException e)      {        reader = null;        eventSink = null;        throw new DomLSEx(LSException.PARSE_ERR, e);      }    catch (IOException e)      {        reader = null;        eventSink = null;        throw new DomLSEx(LSException.PARSE_ERR, e);      }    // return document    Document ret = eventSink.doc;    String systemId = input.getSystemId();    if (systemId != null && ret instanceof DomDocument)      {        ((DomDocument) ret).setDocumentURI(systemId);      }    eventSink = null;    return ret;  }