FileDocCategorySizeDatePackage
TextManipExample.javaAPI DocExample2284Wed May 18 09:39:04 BST 2005com.discursive.jccook.xml.bean

TextManipExample

public class TextManipExample extends Object

Fields Summary
private static Logger
logger
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] pArgs)

      LogInit.init(); 
        TextManipExample example = new TextManipExample();
        example.testDigest();
    
public voidtestDigest()


    	Message message = new Message();
    	message.setText( "hello world!" );
    	
        System.out.println( "Initial Message: " + message.getText() );
        
        
        InputStream encrypt = getClass().getResourceAsStream("./encrypt.xml");
        InputStream decrypt = getClass().getResourceAsStream("./decrypt.xml");

        Digester digester = new Digester();
        digester.addRule( "*/email", new EmailRule() );
        digester.addRule( "*/lower", new LowerRule() );
        digester.addRule( "*/reverse", new ReverseRule() );
        digester.addRule( "*/replace", new ReplaceRule() );
        digester.push( message );
        
        digester.parse( encrypt );
//        digester.parse( decrypt );

        System.out.println("Resulting Message: " + message.getText() );

        digester.parse( decrypt );
        
        System.out.println("Resulting Message: " + message.getText() );