public void begin(String namespace, String name, Attributes attributes)
throws Exception {
// Retrieve any current Catalog with the specified name
Catalog catalog = null;
CatalogFactory factory = CatalogFactory.getInstance();
String nameValue = attributes.getValue(nameAttribute);
if (nameValue == null) {
catalog = factory.getCatalog();
} else {
catalog = factory.getCatalog(nameValue);
}
// Create and register a new Catalog instance if necessary
if (catalog == null) {
Class clazz = digester.getClassLoader().loadClass(catalogClass);
catalog = (Catalog) clazz.newInstance();
if (nameValue == null) {
factory.setCatalog(catalog);
} else {
factory.addCatalog(nameValue, catalog);
}
}
// Push this Catalog onto the top of the stack
digester.push(catalog);