legacy/src/main/java/thredds/catalog/InvCatalogFactory.java
public InvCatalogImpl readXML(InputStream docIs, URI uri) {

    // get ready for XML parsing
    warnMessages.setLength(0);
    errMessages.setLength(0);
    fatalMessages.setLength(0);

    org.jdom2.Document jdomDoc;
    try {
      jdomDoc = saxBuilder.build(docIs);
    } catch (Exception e) {
      InvCatalogImpl cat = new InvCatalogImpl(uri.toString(), null, uri);
      cat.appendErrorMessage("**Fatal:  InvCatalogFactory.readXML failed"
          + "\n Exception= " + e.getClass().getName() + " " + e.getMessage()
          + "\n fatalMessages= " + fatalMessages.toString()
          + "\n errMessages= " + errMessages.toString()
          + "\n warnMessages= " + warnMessages.toString() + "\n", true);
      return cat;
    }

    if (fatalMessages.length() > 0) {
      InvCatalogImpl cat = new InvCatalogImpl(uri.toString(), null, uri);
      cat.appendErrorMessage("**Fatal:  InvCatalogFactory.readXML XML Fatal error(s) =\n" +
          fatalMessages.toString() + "\n", true);
      return cat;
    }

    return readXML(jdomDoc, uri);
  }
public InvCatalogImpl readXML(InputStream docIs, URI uri) {

    // get ready for XML parsing
    warnMessages.setLength(0);
    errMessages.setLength(0);
    fatalMessages.setLength(0);

    org.jdom2.Document jdomDoc;
    try {
      jdomDoc = saxBuilder.build(docIs);
    } catch (Exception e) {
      InvCatalogImpl cat = new InvCatalogImpl(uri.toString(), null, uri);
      cat.appendErrorMessage("**Fatal:  InvCatalogFactory.readXML failed"
          + "\n Exception= " + e.getClass().getName() + " " + e.getMessage()
          + "\n fatalMessages= " + fatalMessages.toString()
          + "\n errMessages= " + errMessages.toString()
          + "\n warnMessages= " + warnMessages.toString() + "\n", true);
      return cat;
    }

    if (fatalMessages.length() > 0) {
      InvCatalogImpl cat = new InvCatalogImpl(uri.toString(), null, uri);
      cat.appendErrorMessage("**Fatal:  InvCatalogFactory.readXML XML Fatal error(s) =\n" +
          fatalMessages.toString() + "\n", true);
      return cat;
    }

    return readXML(jdomDoc, uri);
  }
Create an InvCatalog from an InputStream.
Failures and exceptions are handled
by causing validate() to fail. Therefore, be sure to call validate() before trying
to use the InvCatalog object.

@param docIs : the InputStream to read from
@param uri : the URI of the document, used for resolving reletive references.
@return an InvCatalogImpl object