{
String xml = "<root>" + "Twas noun{1} and the noun{2}" + " did verb{1} and verb{2} in the noun{3}" + "</root>";
StringReader input = new StringReader( xml );
Digester digester = new Digester();
// Configure the digester as required
HashMap<String, Object> nouns = new HashMap<String, Object>();
nouns.put( "1", "brillig" );
nouns.put( "2", "slithy toves" );
nouns.put( "3", "wabe" );
HashMap<String, Object> verbs = new HashMap<String, Object>();
verbs.put( "1", "gyre" );
verbs.put( "2", "gimble" );
MultiVariableExpander expander = new MultiVariableExpander();
expander.addSource( "noun", nouns );
expander.addSource( "verb", verbs );
digester.setSubstitutor( new VariableSubstitutor( expander ) );
digester.addObjectCreate( "root", SimpleTestBean.class );
digester.addCallMethod( "root", "setAlpha", 0 );
// Parse our test input.
SimpleTestBean root = digester.parse( input );
assertNotNull( "Digester returned no object", root );
assertEquals( "Twas brillig and the slithy toves" + " did gyre and gimble in the wabe", root.getAlpha() );
}