in commons-digester3-core/src/main/java/org/apache/commons/digester3/RulesBase.java [181:204]
protected List<Rule> lookup( final String namespaceURI, final String pattern )
{
// Optimize when no namespace URI is specified
final List<Rule> list = this.cache.get( pattern );
if ( list == null )
{
return ( null );
}
if ( ( namespaceURI == null ) || ( namespaceURI.isEmpty() ) )
{
return ( list );
}
// Select only Rules that match on the specified namespace URI
final ArrayList<Rule> results = new ArrayList<Rule>();
for ( final Rule item : list )
{
if ( ( namespaceURI.equals( item.getNamespaceURI() ) ) || ( item.getNamespaceURI() == null ) )
{
results.add( item );
}
}
return ( results );
}