Example usage for org.apache.commons.digester3 Digester clear

List of usage examples for org.apache.commons.digester3 Digester clear

Introduction

In this page you can find the example usage for org.apache.commons.digester3 Digester clear.

Prototype

public void clear() 

Source Link

Document

Clear the current contents of the default object stack, the param stack, all named stacks, and other internal variables.

Usage

From source file:com.dotosoft.dot4command.config.xml.XmlConfigParser.java

/**
 * <p>Parse the XML document at the specified URL using the configured
 * <code>RuleSet</code>, registering catalogs with nested chains and
 * commands as they are encountered.  Use this method <strong>only</strong>
 * if you have included one or more <code>factory</code> elements in your
 * configuration resource.</p>/*from w ww. jav a  2  s  .c o m*/
 *
 * @param <K> the type of keys maintained by the context associated with this command
 * @param <V> the type of mapped values
 * @param <C> Type of the context associated with this command
 * @param url <code>URL</code> of the XML document to be parsed
 * @return a CatalogFactory instance parsed from the given location
 * @exception ChainConfigurationException if a parsing error occurs
 */
public <K extends String, V extends Object, C extends Map<K, V>> CatalogFactory<K, V, C> parse(URL url) {
    // Prepare our Digester instance
    Digester digester = getDigester();
    digester.clear();

    // Parse the configuration document
    try {
        digester.parse(url);
    } catch (Exception e) {
        String msg = String.format("Error parsing digester configuration at url: %s", url);
        throw new ChainConfigurationException(msg, e);
    }
    // FIXME get rid of singleton pattern and create a new instance here
    return CatalogFactoryBase.getInstance();
}