code: protected static Document parseDocumentImpl(
          InputSource inputSource, boolean enableExternalEntities,
          boolean isNamespaceAware)
          throws ParserConfigurationException, SAXException, IOException
      {
          DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
          factory.setNamespaceAware(isNamespaceAware);
          enableOrDisableExternalEntityParsing(factory, enableExternalEntities);
          DocumentBuilder builder = factory.newDocumentBuilder();
          Document document = builder.parse(inputSource);
          return document;
      }
docs: Return an XML Document parsed from the given input source.
  
  @param inputSource
  an XML document input source that will be parsed into a DOM.
  @param enableExternalEntities
  enable external entities; beware of XML External Entity (XXE) injection.
  @param isNamespaceAware
  enable or disable namespace awareness in the underlying
  {@link DocumentBuilderFactory}
  @return
  a builder node that can be used to add more nodes to the XML document.
  @throws ParserConfigurationException
  
  @throws FactoryConfigurationError
  @throws ParserConfigurationException
  @throws IOException
  @throws SAXException