src/main/java/org/jboss/util/xml/catalog/readers/SAXCatalogReader.java
public void startElement (String namespaceURI,
			    String localName,
			    String qName,
			    Attributes atts)
    throws SAXException {

    if (abandonHope) {
      return;
    }

    if (saxParser == null) {
      String saxParserClass = getCatalogParser(namespaceURI,
					       localName);

      if (saxParserClass == null) {
	abandonHope = true;
	if (namespaceURI == null) {
	  debug.message(2, "No Catalog parser for " + localName);
	} else {
	  debug.message(2, "No Catalog parser for "
			+ "{" + namespaceURI + "}"
			+ localName);
	}
	return;
      }

      try {
	saxParser = (SAXCatalogParser)
	  Class.forName(saxParserClass).newInstance();

	saxParser.setCatalog(catalog);
	saxParser.startDocument();
	saxParser.startElement(namespaceURI, localName, qName, atts);
      } catch (ClassNotFoundException cnfe) {
	saxParser = null;
	abandonHope = true;
	debug.message(2, cnfe.toString());
      } catch (InstantiationException ie) {
	saxParser = null;
	abandonHope = true;
	debug.message(2, ie.toString());
      } catch (IllegalAccessException iae) {
	saxParser = null;
	abandonHope = true;
	debug.message(2, iae.toString());
      } catch (ClassCastException cce ) {
	saxParser = null;
	abandonHope = true;
	debug.message(2, cce.toString());
      }
    } else {
      saxParser.startElement(namespaceURI, localName, qName, atts);
    }
  }
public void startElement (String namespaceURI,
			    String localName,
			    String qName,
			    Attributes atts)
    throws SAXException {

    if (abandonHope) {
      return;
    }

    if (saxParser == null) {
      String saxParserClass = getCatalogParser(namespaceURI,
					       localName);

      if (saxParserClass == null) {
	abandonHope = true;
	if (namespaceURI == null) {
	  debug.message(2, "No Catalog parser for " + localName);
	} else {
	  debug.message(2, "No Catalog parser for "
			+ "{" + namespaceURI + "}"
			+ localName);
	}
	return;
      }

      try {
	saxParser = (SAXCatalogParser)
	  Class.forName(saxParserClass).newInstance();

	saxParser.setCatalog(catalog);
	saxParser.startDocument();
	saxParser.startElement(namespaceURI, localName, qName, atts);
      } catch (ClassNotFoundException cnfe) {
	saxParser = null;
	abandonHope = true;
	debug.message(2, cnfe.toString());
      } catch (InstantiationException ie) {
	saxParser = null;
	abandonHope = true;
	debug.message(2, ie.toString());
      } catch (IllegalAccessException iae) {
	saxParser = null;
	abandonHope = true;
	debug.message(2, iae.toString());
      } catch (ClassCastException cce ) {
	saxParser = null;
	abandonHope = true;
	debug.message(2, cce.toString());
      }
    } else {
      saxParser.startElement(namespaceURI, localName, qName, atts);
    }
  }
The SAX2 <code>startElement</code> method.

<p>The catalog parser is selected based on the namespace of the
first element encountered in the catalog.</p>