org.apache.commons.digester.xmlrules
Class DigesterRuleParser.IncludeRule
- DigesterRuleParser
private class DigesterRuleParser.IncludeRule
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.
void | begin(Attributes attributes) - To include a rules xml file, we instantiate another Digester, and
another DigesterRulesRuleSet.
|
private void | includeProgrammaticRules(String className) - Creates an instance of the indicated class.
|
private void | includeXMLRules(String fileName) - Creates another DigesterRuleParser, and uses it to extract the rules
out of the give XML file.
|
begin , begin , body , body , end , end , finish , getDigester , getNamespaceURI , setDigester , setNamespaceURI |
IncludeRule
public IncludeRule()
begin
public void begin(Attributes attributes)
throws Exception
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.
- begin in interface Rule
includeProgrammaticRules
private void includeProgrammaticRules(String className)
throws ClassNotFoundException,
ClassCastException,
InstantiationException,
IllegalAccessException
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)
throws IOException,
SAXException,
CircularIncludeException
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 (c) 2001-2004 - Apache Software Foundation