i need to sum up the values from an XML file based on some criteria
my XMl Is as follows
<?xml version="1.0" encoding="utf-8" ?>
<transactions>
<transcation ID="1">
<BankName>ABC</BankName>
<TemplatModel>CT1</TemplatModel>
<Date>12/12/2014</Date>
<Payeename>xyz</Payeename>
<Amount>200</Amount>
</transcation>
<transcation ID="2">
<BankName>EFG</BankName>
<TemplatModel>CT2</TemplatModel>
<Date>12/12/2014</Date>
<Payeename>xyz</Payeename>
<Amount>100</Amount>
</transcation>
<transcation ID="3">
<BankName>ABC</BankName>
<TemplatModel>CT1</TemplatModel>
<Date>10/12/2014</Date>
<Payeename>pqr</Payeename>
<Amount>400</Amount>
</transcation>
<transcation ID="4">
<BankName>EFG</BankName>
<TemplatModel>CT2</TemplatModel>
<Date>11/12/2014</Date>
<Payeename>asd</Payeename>
<Amount>300</Amount>
</transcation>
</transactions>
i need to find the sum of amount where BankName="ABC"
and in another query i need to find the sum of amount whose date less than="12/12/2014"
and one more doubt which xml structure is better
<transactions>
<transcation ID="1" BankName="ABC" TemplatModel ="CT1" Date="12/12/2014" Payeename="asd" Amount="200"/>
<transcation ID="2" BankName="EFG" TemplatModel ="CT2" Date="12/12/2014" Payeename="xyz" Amount="100"/>
<transcation ID="3" BankName="ABC" TemplatModel ="CT1" Date="10/12/2014" Payeename="pqr" Amount="400"/>
<transcation ID="4" BankName="EFG" TemplatModel ="CT2" Date="11/12/2014" Payeename="asd" Amount="300"/>
</transactions>
No comments:
Post a Comment