Reputation: 12896
Let's say I have the following XML document:
<Offices>
<Office name="P">
<Counter>1000</Counter>
</Office>
<Office name="K">
<Counter>1006</Counter>
</Office>
</Offices>
With that document I need to perform the following in Java:
Counter
given a certain value for a name
attribute.Counter
for exactly this Office
.For 2. I have considered using XPath but editing/updating the XML seems to be not that easy this way.
How could I go through the XML finding a certain office name and update its counter? The XML itself won't be large, only something like 20 office entries max.
Upvotes: 0
Views: 90
Reputation: 84
You can try looking at this answer: https://stackoverflow.com/a/5059411/1571550
It seems pretty straightforward and generic solution.
Upvotes: 1