How to change XML attribute value for a list of elements

Hi guys,
I have a XML fragment where there are a lot of "Charge" elements. I need to change the value of the attribute "Amount" where Type="5" and Id="977"

<TotalAmount>
<Charge PT="P" Amount="0" CurrCode="PWT" Type="5" Id="76"></Charge>
<Charge PT="P" Amount="0" CurrCode="PWT" Type="5" Id="978"></Charge>
<Charge PT="P" Amount="166845" CurrCode="PWT" Type="5" Id="977"></Charge> <------------ This line
<Charge PT="P" Amount="166845" CurrCode="PWT" Type="5" Id="79"></Charge>
<Charge PT="P" Amount="166845" CurrCode="PWT" Type="19" Id="79"></Charge>
<Charge PT="P" Amount="198546" CurrCode="PWT" Type="5" Id="77"></Charge>
<Charge PT="P" Amount="198546" CurrCode="PWT" Type="19" Id="77"></Charge>
<Charge PT="P" Amount="198546" CurrCode="PWT" Type="5" Id="178"></Charge>
<Charge PT="P" Amount="0" CurrCode="PWT" Type="5" Id="969"></Charge>
<Charge PT="P" Amount="200295" CurrCode="PWT" Type="5" Id="961"></Charge>
<Charge PT="P" Amount="-200295" CurrCode="PWT" Type="5" Id="11"></Charge>
<Charge PT="P" Amount="198545" CurrCode="PWT" Type="9" Id="703"></Charge>
<Charge PT="P" Amount="0" CurrCode="PWT" Type="9" Id="704"></Charge>
<Charge PT="P" Amount="198546" CurrCode="PWT" Type="9" Id="78"></Charge>
</TotalAmount>

Thanks
One option would be to use a xml library. http://www.firstobject.com/dn_markup.htm
tanks for your answer

[URL="https://ekahroba.com"]فروشگاه برق [/URL]
Registered users can post here. Sign in or register to post.