以下是一段digester框架载入规则文件的代码,File的toURL方法已被废弃,看了一下JDK文档,感觉应该改为ruleFile.toURI().toURL(),因为时间关系来不及细细研究toURL和toURI方法的作用,先记下,等有空再看.
public void parse() throws Exception
{
File xmlFile = new File(getConfigPath() + data) ;
File ruleFile = new File(getConfigPath() + rule) ;
Digester digester = DigesterLoader.createDigester( ruleFile.toURI().toURL()/*ruleFile.toURL()*/);
digester.push(this) ;
digester.parse(xmlFile) ;
}