Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I want to take the sum of the amount node (node name-amt) in the below XML for the due date node coming as (2023-05-03) (node name-pmtDueDate) with Type node value as "Principal and Pass thru" (node name- type)in the below XML updated in C#.

What I have tried:

XML
<NS1:getInstallmentHistoryReply xmlns:NS1="urn:esbbank.com/gbo/xml/schemas/v1_0/">
	<eAI_HEADER>
		<msgChannel>HTTP</msgChannel>
		<requestorLanguage>E</requestorLanguage>
	</eAI_HEADER>
	<eAI_BODY>
		<referenceNum>508PB1AC26B2C118</referenceNum>
         <installmentHistoryDetail>
			<billidNum>17</billidNum>
			<amt>106.450000</amt>
			<type>Pass thru</type>
			<pmtDueDate>2023-05-03T00:00:00</pmtDueDate>
		</installmentHistoryDetail>
		 <installmentHistoryDetail>
			<billidNum>17</billidNum>
			<amt>106.450000</amt>
			<type>Profit</type>
			<pmtDueDate>2023-05-03T00:00:00</pmtDueDate>
		</installmentHistoryDetail>
		 <installmentHistoryDetail>
			<billidNum>17</billidNum>
			<amt>106.450000</amt>
			<type>Principal</type>
			<pmtDueDate>2023-05-03T00:00:00</pmtDueDate>
		</installmentHistoryDetail>
		 <installmentHistoryDetail>
			<billidNum>17</billidNum>
			<amt>106.450000</amt>
			<type>Principal</type>
			<pmtDueDate>2023-06-03T00:00:00</pmtDueDate>
		</installmentHistoryDetail>
		
	</eAI_BODY>
</NS1:getInstallmentHistoryReply>
Posted
Updated 27-Oct-23 5:01am
v3
Comments
Richard Deeming 26-Oct-23 9:30am    
And?

What have you tried, and where are you stuck?

Just dumping an XML file and saying "I want ..." is not a question; it's a demand for someone else to do your work for you.
Dave Kreskowiak 26-Oct-23 10:01am    
212.900000

Or did you have a question about code YOU are supposed to be writing? We're not here to do your work for you.
Graeme_Grant 27-Oct-23 8:30am    
You missed one :P

Total Amount: 319.350000
Dave Kreskowiak 27-Oct-23 9:29am    
No, I didn't. Check the conditions again.
Graeme_Grant 27-Oct-23 19:31pm    
Yes, you are right. I failed to apply the last condition.

1 solution

We can't answer that - partly because as Richard and Dave have said, you didn't actually ask a question, or show any effort, but mostly because there are too many ways to do it, and we have no idea what you have done so far or how our solution might fit into that codebase.

But this is where I'd probably start: Overview - LINQ to XML - .NET | Microsoft Learn[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900