code: public static Document parse(Reader reader, boolean validating, boolean namespaceAware, boolean allowDocTypeDeclaration)
              throws SAXException, IOException, ParserConfigurationException {
          DocumentBuilderFactory factory = FactorySupport.createDocumentBuilderFactory();
          factory.setNamespaceAware(namespaceAware);
          factory.setValidating(validating);
          setQuietly(factory, XMLConstants.FEATURE_SECURE_PROCESSING, true);
          setQuietly(factory, "http://apache.org/xml/features/disallow-doctype-decl", !allowDocTypeDeclaration);
          DocumentBuilder documentBuilder = factory.newDocumentBuilder();
          return documentBuilder.parse(new InputSource(reader));
      }
docs: Creates a DocumentBuilder and uses it to parse the XML text read from the given reader, allowing
  parser validation, namespace awareness and permission of DOCTYPE declarations to be controlled.
  
  @param reader                  the reader to read the XML text from
  @param validating              whether to validate the XML
  @param namespaceAware          whether the parser should be namespace aware
  @param allowDocTypeDeclaration whether the parser should allow DOCTYPE declarations
  @return the root node of the parsed tree of Nodes
  @throws SAXException                 Any SAX exception, possibly wrapping another exception.
  @throws IOException                  An IO exception from the parser, possibly from a byte
  stream or character stream supplied by the application.
  @throws ParserConfigurationException if a DocumentBuilder cannot be created which satisfies
  the configuration requested.