private void digestConfigRecursively(Reader stream, String baseURI)
      throws IOException, SAXException, URISyntaxException, SmooksConfigurationException {
    Document configDoc;
    String streamData = StreamUtils.readStream(stream);

    try {
      configDoc =
          XmlUtil.parseStream(
              new StringReader(streamData),
              getDTDEntityResolver(),
              XmlUtil.VALIDATION_TYPE.DTD,
              true);
      logger.debug(
          "Using a deprecated Smooks configuration DTD '"
              + DTD_V10
              + "'.  Update configuration to use XSD '"
              + XSD_V10
              + "'.");
      digestV10DTDValidatedConfig(configDoc);
      logger.debug(
          "Using a deprecated Smooks configuration DTD '"
              + DTD_V10
              + "'.  Update configuration to use XSD '"
              + XSD_V10
              + "'.");
    } catch (Exception e) {
      // Must be an XSD based config...
      try {
        configDoc = XmlUtil.parseStream(new StringReader(streamData));
      } catch (ParserConfigurationException ee) {
        throw new SAXException("Unable to parse Smooks configuration.", ee);
      }

      XsdDOMValidator validator = new XsdDOMValidator(configDoc);
      String defaultNS = validator.getDefaultNamespace().toString();

      validator.validate();

      configStack.peek().defaultNS = defaultNS;
      if (XSD_V10.equals(defaultNS)) {
        if (validator.getNamespaces().size() > 1) {
          throw new SmooksConfigurationException(
              "Unsupported use of multiple configuration namespaces from inside a v1.0 Smooks configuration. Configuration extension not supported from a v1.0 configuration.  Use the v1.1 configuration namespace.");
        }
        digestV10XSDValidatedConfig(baseURI, configDoc);
      } else if (XSD_V11.equals(defaultNS)) {
        digestV11XSDValidatedConfig(baseURI, configDoc);
      } else {
        throw new SAXException(
            "Cannot parse Smooks configuration.  Unsupported default Namespace '"
                + defaultNS
                + "'.");
      }
    }

    if (resourcelist.isEmpty()) {
      throw new SAXException(
          "Invalid Content Delivery Resource archive definition file: 0 Content Delivery Resource definitions.");
    }
  }