input.append( " file='src/test/resources/org/apache/commons/digester3/plugins/xmlrules1.xml'" );
input.append( " />" );
input.append( " <object plugin-id='testobject'/>" );
input.append( "</root>" );
Digester digester = new Digester();
PluginRules rc = new PluginRules();
digester.setRules( rc );
PluginDeclarationRule pdr = new PluginDeclarationRule();
digester.addRule( "root/plugin", pdr );
PluginCreateRule pcr = new PluginCreateRule( ObjectTestImpl.class );
digester.addRule( "root/object", pcr );
try
{
digester.parse( new StringReader( input.toString() ) );
}
catch ( Exception e )
{
throw e;
}
Object root = digester.getRoot();
assertEquals( ObjectTestImpl.class, root.getClass() );
ObjectTestImpl testObject = (ObjectTestImpl) root;
assertEquals( "xmlrules1", testObject.getValue() );
}