Digester的类中设置规则配置

<?xml version="1.0" encoding="utf-8"?>
<terminal hostname="" port="" version="" update-time="">
<policy name="PmSymantecPolicy">
<method id="isInstall" class="Install">
<param name="installPackAddress" value=""/>
<result value="true" meid="isNewVersion"/>
</method>
<method id="isNewVersion" class="Version">
<param name="newVersionDate" value=""/>
<param name="upgradePackAddress" value=""/>
<result value="true" meid="isOverLimit"/>
</method>
<method id="isOverLimit" class="Limit">
<param name="timeLimit" value=""/>
</method>
</policy>
</terminal>

Digester digester=new Digester();
digester.setValidating(false);

digester.addObjectCreate("terminal/policy", Policy.class);
digester.addSetProperties("terminal/policy");
digester.addSetNext("terminal/policy", "addPolicy");

digester.addObjectCreate("terminal/policy/method",Method.class);
digester.addSetProperties("terminal/policy/method","id","id");
digester.addSetProperties("terminal/policy/method","class","className");
digester.addSetNext("terminal/policy/method", "addMethod");

digester.addObjectCreate("terminal/policy/method/param",Param.class);
digester.addSetProperties("terminal/policy/method/param");
digester.addSetNext("terminal/policy/method/param", "addParam");

digester.addObjectCreate("terminal/policy/method/result",Result.class);
digester.addSetProperties("terminal/policy/method/result");
digester.addSetNext("terminal/policy/method/result", "addResult");

你可能感兴趣的:(xml)