Provides for manipulation of xml attributes and element body text before the data is processed by any Rule objects.

The class org.apache.commons.digester.Substitutor defines an abstract interface for mechanisms which manipulate xml attributes and body text. The Digester method setSubstitutor can be used to define a concrete substitutor that will be applied to the data before it is passed to the matching rules.

This package provides some useful concrete implementations of the abstract Substitutor class. In particular, it provides an implementation that allows the application to define "variables" which the input data can reference using a syntax such as "${user.name}".

Here's an example of setting up the VariableSubstitutor:

      // set up the variables the input xml can reference
      Map vars = new HashMap();
      vars.put("user.name", "me");
      vars.put("os", "Linux");

      // map ${varname} to the entries in the var map
      MultiVariableExpander expander = new MultiVariableExpander();
      expander.addSource("$", vars);

      // allow expansion in both xml attributes and element text
      Substitutor substitutor = new VariableSubstitutor(expander);

      Digester digester = new Digester();
      digester.setSubstitutor(substitutor);