org.apache.commons.digester.xmlrules

Class DigesterRuleParser.IncludeRule

private class DigesterRuleParser.IncludeRule extends Rule

A rule for including one rules XML file within another. Included files behave as if they are 'macro-expanded' within the includer. This means that the values of the pattern stack are prefixed to every pattern in the included rules.

This rule will detect 'circular' includes, which would result in infinite recursion. It throws a CircularIncludeException when a cycle is detected, which will terminate the parse.

Constructor Summary
IncludeRule()
Method Summary
voidbegin(Attributes attributes)
To include a rules xml file, we instantiate another Digester, and another DigesterRulesRuleSet.
voidincludeProgrammaticRules(String className)
Creates an instance of the indicated class.
voidincludeXMLRules(String fileName)
Creates another DigesterRuleParser, and uses it to extract the rules out of the give XML file.

Constructor Detail

IncludeRule

public IncludeRule()

Method Detail

begin

public void begin(Attributes attributes)
To include a rules xml file, we instantiate another Digester, and another DigesterRulesRuleSet. We pass the pattern stack and the target Digester to the new rule set, and tell the Digester to parse the file.

includeProgrammaticRules

private void includeProgrammaticRules(String className)
Creates an instance of the indicated class. The class must implement the DigesterRulesSource interface. Passes the target digester to that instance. The DigesterRulesSource instance is supposed to add rules into the digester. The contents of the current pattern stack will be automatically prepended to all of the pattern strings added by the DigesterRulesSource instance.

includeXMLRules

private void includeXMLRules(String fileName)
Creates another DigesterRuleParser, and uses it to extract the rules out of the give XML file. The contents of the current pattern stack will be prepended to all of the pattern strings parsed from the file.
Copyright 2001-2005 The Apache Software Foundation.