• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Jakarta Digester hashmaps

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I hope someone can help here. I want to create a HashMap of objects using the following xml structure:

<map>
<entry key="someKey1">
<filterObject type="myType1" name="myName1"/>
<filterObject type="myType2" name="myName2"/>
<filterObject type="myType3" name="myName3"/>
</entry>
<entry key="someKey2">
<filterObject type="myType4" name="myName4"/>
<filterObject type="myType5" name="myName5"/>
</entry>
<map>

I tried the following code but it gives me a null pointer exception:
//create the object:
digester.addObjectCreate(/map/entry/filterObject, FilterObject.class);
// set the simple string properties
this.digester.addSetProperties(pattern);

// create a rule on the second-to-top (1st in this case) object on the
// digester stack, with 2 parameters

Rule rule = new CallMethodRule(1, "addFilterObject", 2);
this.digester.addRule(/map/entry/filterObject, r);
this.digester.addCallParam(/map/entry/filterObject, 0, true);
this.digester.addCallParam(/map/entry, 1, "key");


Any help would be greatly appreciated!
 
Always look on the bright side of life. At least this ad is really tiny:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic