Richard HALLIER wrote:

Hi all,
I've a simple problem, and I cant manage to resolve it, what are the
digester rules for the follwing reccurent pattern :

<ressource type="page" id="item.entite">
        <locator type="label" value="zobilamouche"/>
        <ressource type="form" id="formID">
                <locator type="name" value="entityForm"/>
        </ressource>
</ressource>

I've added the following methods to the Ressouce class :
addRessource(Ressource re) and setParent(Ressource re)

Thank you for your precious help.

Richard


You can use patterns like "*/ressource" and "*/locator" to match those elements, no matter how deeply they are nested. So, you might have rules like this:

 digester.addObjectCreate("*/ressource", "com.mycompany.Ressource");
 digester.addSetProperties("*/ressource");
 digester.addCallNext("*/ressource", "com.mycompany.Ressource");

(I would have the call to setParent() happen inside the addRessource() method, instead of requiring both to be done by Digester rules).

Because these rules will be fired for even the outermost <ressource> element, you'll want to push a Ressource object onto the digester stack before you start parsing.

Craig

PS: If "ressource" is supposed to be in English, it's actually spelled "resource".


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to