• 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

Can JDOM do this?

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a JDOM question. I need to read in an XML file and move to a particular level within it. When I get to this level (eg account)I need to find a particular tag within this level (eg number) and then manipulate the contents of certain elements. So if I have 2 accounts as below I need to take the beginning balance of each, add them and then output them in a new xml file. Is this level of complexity suitable for JDOM?

Thanks

EG
<test>
<portfolio>
<account>
<name>Account 1</name>
<number>1223297</number>
<begbal>12000</begbal>
</account>
<account>
<name>Account 2</name>
<number>6432787</number>
<begbal>345454</begbal>
</account>
</portfolio>
</test>
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yup, that should be possible.
One thing I would caution re adding is the fact that you must watch for
integer overflow. If your file is really big (say you have a file with
500 accounts) and the amounts you deal with are also big, then you might
want to watch the totals carefully.

Welcome to Javaranch.
Man!!! Your beginning balance is in six digits, huh!
Wonder why you are writing programs

- m
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic