Posted By:
Aad_Nales
Posted On:
Friday, October 3, 2003 07:29 AM
I am trying use HashMaps in Digester. What I want to do is create a HashMap of beans. The beans consists of several properties one of which is "name". I want to use this name field as the 'key' and the whole bean as the 'value' in a Map. The start is pretty straight forward. Here the piece of XML i am trying to process. I am not worried about adding the instructions but I wish to add every rule (I only show one) to a HashMap. Here is what i do. digester.addObjectCreate("reporter", "java.util.HashMap"); digester.addSetNext("reporter", "done"); //rule digester.addObjectCre
More>>
I am trying use HashMaps in Digester. What I want to do is create a HashMap of beans. The beans consists of several properties one of which is "name". I want to use this name field as the 'key' and the whole bean as the 'value' in a Map.
The start is pretty straight forward. Here the piece of XML i am trying to process.
I am not worried about adding the instructions but I wish to add every rule (I only show one) to a HashMap. Here is what i do.
digester.addObjectCreate("reporter", "java.util.HashMap");
digester.addSetNext("reporter", "done");
//rule
digester.addObjectCreate("*/rule", "com.rcs.community.document.xml.Rule");
digester.addSetProperties("*/rule");
... ?? what to add here ??
What i am puzzled about is adding how to add a Rule object to the HashMap using both a
property
and a whole
instance
. Is there anybody outthere who can help me?
The reason that I want to use HashMap and not some specific object is that I don't what to add loads of new objects to my source tree if all they do is some parsing.
TIA
Aad Nales
<<Less