@Override
  public void read(String servletContextName, ClassLoader classLoader, String source)
      throws Exception {

    InputStream inputStream = classLoader.getResourceAsStream(source);

    if (inputStream == null) {
      if (_log.isWarnEnabled() && !source.endsWith("-ext.xml")) {
        _log.warn("Cannot load " + source);
      }

      return;
    }

    if (_log.isDebugEnabled()) {
      _log.debug("Loading " + source);
    }

    Document document = SAXReaderUtil.read(inputStream, true);

    DocumentType documentType = document.getDocumentType();

    String publicId = GetterUtil.getString(documentType.getPublicId());

    if (publicId.equals("-//Liferay//DTD Resource Action Mapping 6.0.0//EN")) {

      if (_log.isWarnEnabled()) {
        _log.warn("Please update " + source + " to use the 6.1.0 format");
      }
    }

    Element rootElement = document.getRootElement();

    for (Element resourceElement : rootElement.elements("resource")) {
      String file = resourceElement.attributeValue("file").trim();

      read(servletContextName, classLoader, file);

      String extFile = StringUtil.replace(file, ".xml", "-ext.xml");

      read(servletContextName, classLoader, extFile);
    }

    read(servletContextName, document);
  }