Example usage for org.apache.commons.digester Rule getNamespaceURI

List of usage examples for org.apache.commons.digester Rule getNamespaceURI

Introduction

In this page you can find the example usage for org.apache.commons.digester Rule getNamespaceURI.

Prototype

public String getNamespaceURI() 

Source Link

Document

Return the namespace URI for which this Rule is relevant, if any.

Usage

From source file:com.icesoft.faces.webapp.parser.RulesBase.java

/**
 * Return a List of Rule instances for the specified pattern that also
 * match the specified namespace URI (if any).  If there are no such
 * rules, return <code>null</code>.
 *
 * @param namespaceURI Namespace URI to match, or <code>null</code> to
 *  select matching rules regardless of namespace URI
 * @param pattern Pattern to be matched/*from   w  w w.j  av  a 2  s  .c  o  m*/
 */
protected List lookup(String namespaceURI, String pattern) {

    // Optimize when no namespace URI is specified
    List list = (List) this.cache.get(pattern);
    if (list == null) {
        return (null);
    }
    if (namespaceURI == null) {
        return (list);
    }

    // Select only Rules that match on the specified namespace URI
    ArrayList results = new ArrayList();
    Iterator items = list.iterator();
    while (items.hasNext()) {
        Rule item = (Rule) items.next();
        if ((namespaceURI.equals(item.getNamespaceURI())) || (item.getNamespaceURI() == null)) {
            results.add(item);
        }
    }
    return (results);

}