Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

XPATH readout - HAshmap/Array or Enum

807606Feb 7 2007 — edited Feb 8 2007
Hi,
I am reading this from my xml file:
<Taxes>
                  <Tax TaxCode="code1" Amount="500.00"/>
                  <Tax TaxCode="code2" Amount="100.00"/>
                  <Tax TaxCode="code3" Amount="100.00"/>
                  <Tax TaxCode="code4" Amount="1000.00"/>
                  <Tax TaxCode="code5" Amount="2000.00"/>
                </Taxes>
and am passing the Taxcodes as keys and the Amounts as values into a HashMap.
My Problem is, if there are more than 3 TaxCodes, i have to return the amounts of the "extra" Taxcodes as a summed value and forget about the other taxcodes. Thus leaving me with:
                  <Tax TaxCode="code1" Amount="500.00"/>
                  <Tax TaxCode="code2" Amount="100.00"/>
                  <Tax TaxCode="code3" Amount="3100.00"/>
Is Hashmap the way to go here - or is there an easier way?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 8 2007
Added on Feb 7 2007
9 comments
219 views