:D Cerebrus.. kindly advise me what is the right way to design this XML. I thought I had a good design, considering plenty samples across the net. But when I see the functions XML can perform, i often realize that there is more to XML than what I am creating. So kindly advise what kind of structure would suit good?
If you notice, my XML stores some accounting records. Like a financial balance sheet. There are assets and liabilities in it. Then accounts and sub-accounts, all have values in them. So I need the power of fast summation of these values. On Nov 9, 4:55 pm, Cerebrus <[email protected]> wrote: > Rather than wasting time designing an XPath to handle all corner cases > in such a poorly designed XML, I would spend time finding out who > created such an XML and then firing or atleast censuring him/her. > > On Nov 9, 2:18 pm, Faraz Azhar <[email protected]> wrote: > > > > > > sum(/Database/it...@code='4000']/Item) > > > Hmm.. this works on above XML file. But if I specify the Code as 4001 > > (Code=4001) , then it returns zero. I guess I can make a work-around > > for that. > > But this is my real XML file.. it has nested nodes in it. Have a > > look:http://dotnetdevelopment.pastebin.com/m4aee52fb > > > I write the XPath query as follows: "sum(/Accounts/accou...@code=4003]/ > > Account)" .. It doesnt work. > > I want to have a query in which if I specify the Code=4003, it should > > give me sum of 4003.1, 4003.2, 4003.3 which would be 11100. > > And if I specify Code=4000, it should sum all the child nodes; which > > are 4001,4002,4003,4003.1,4003.2,4003.3 and should return 50760 value.
