code: void doParse(String systemId, String publicId, Reader reader,
              InputStream stream, String encoding) throws Exception {
          if (handler == null) {
              throw new IllegalStateException("no callback handler");
          }
  
          alreadyWarnedAboutPrivateUseCharacters = false;
          initializeVariables();
  
          // predeclare the built-in entities here (replacement texts)
          // we don't need to intern(), since we're guaranteed literals
          // are always (globally) interned.
          setInternalEntity("amp", "&#38;");
          setInternalEntity("lt", "&#60;");
          setInternalEntity("gt", "&#62;");
          setInternalEntity("apos", "&#39;");
          setInternalEntity("quot", "&#34;");
  
          try {
              // pushURL first to ensure locator is correct in startDocument
              // ... it might report an IO or encoding exception.
              handler.startDocument();
              pushURL(false, "[document]",
                      // default baseURI: null
                      new ExternalIdentifiers(publicId, systemId, null), reader,
                      stream, encoding, false);
  
              parseDocument();
          } catch (EOFException e) {
              // empty input
              fatal("Empty document, with no root element.");
          } finally {
              if (reader != null) {
                  try {
                      reader.close();
                  } catch (IOException e) {
                      /* ignore */
                  }
              }
              if (stream != null) {
                  try {
                      stream.close();
                  } catch (IOException e) {
                      /* ignore */
                  }
              }
              if (is != null) {
                  try {
                      is.close();
                  } catch (IOException e) {
                      /* ignore */
                  }
              }
          }
      }
docs: package private