private static Configuration expandValues( final PropertyExpander expander,
final Configuration input,
final Map data )
throws Exception
{
final DefaultConfiguration output =
new DefaultConfiguration( input.getName(),
input.getPath(),
input.getLocation() );
final String[] names = input.getAttributeNames();
for( int i = 0; i < names.length; i++ )
{
final String name = names[ i ];
final String value = input.getAttribute( name );
final String newValue = expander.expandValues( value, data );
output.setAttribute( name, newValue );
}
final Configuration[] children = input.getChildren();
for( int i = 0; i < children.length; i++ )
{
final Configuration child =
expandValues( expander, children[ i ], data );
output.addChild( child );
}
final String content = input.getValue( null );
if( null != content )
{
final String newValue =
expander.expandValues( content, data );
output.setValue( newValue );
}
return output;
}