You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by rmanchu <rm...@gmail.com> on 2005/05/12 07:41:14 UTC

quick Digester help

<linked-forms>
     <parent-form name="article">
         <child-form name="comment" field="article" />
     </parent-form>
</linked-forms>

got 3 classes, one for each XML node type. at the end, <linked-forms> is 
a custom HashMap(parent-form.name, List-of(child-form)). in this setup 
the parent-form bean becomes obsolete although this setup works fine. i 
would like to remove use of the parent-form class altogether. what i 
don't know is how to call method HashMap.put(key, val) from digester. i 
suppost i would have to create a temp class. but i don't know what goes 
in it :(. help needed :)

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

     digester.addObjectCreate("linked-forms", LinkedForms.class);
     digester.addObjectCreate(
             "linked-forms/parent-form", ParentForm.class);
         digester.addSetProperties(
                 "linked-forms/parent-form", "name", "name");
         digester.addObjectCreate(
                 "linked-forms/parent-form/child-form", ChildForm.class);
             digester.addSetProperties(
                 "linked-forms/parent-form/child-form", "name", "name");
             digester.addSetProperties(
                 "linked-forms/parent-form/child-form","field","field");
         digester.addSetNext(
                 "linked-forms/parent-form/child-form", "addChildForm");
     digester.addSetNext("linked-forms/parent-form", "addLinkedForm");

thanx
riyaz

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org