Get node count from XML File based on child node value

Hello,

I am reading XML file and my requirement is to count the number of entries for brand “BMW” despite of its model. GIven example, should return “3” and write these 3 values to excel file. Could you please help me to achieve this or give leads to find a solution.

<country>
	<state>Texas</state>
		<cars>		  
                     <brand>BMW</brand>
                     <model>X1</model>
                     <unit>210000</unit>		
		</cars>
		<cars>		  
                    <brand>BMW</brand>
                    <model>X6</model>
                    <unit>210000</unit>		
		</cars>
		<cars>		  
                    <brand>BMW</brand>
                    <model>X7</model>
                     <unit>210000</unit>		
		</cars>
		<cars>		  
                     <brand>Ford</brand>
                     <model>mustang</model>
                     <unit>319000</unit>		
		</cars>
		<cars>		  
                     <brand>Volvo</brand>
                    <model>XC90</model>
                     <unit>91100</unit>		
		</cars>	
</country>

Heyy

check this @Uday132

Main.xaml (12.1 KB)

1 Like

Thanks! On top of that, I’ve added excel application scope and write cell values using counter variable.

Great @Uday132, the deserialize and the conditions should work if the structure of XML is same all the time. No need to worry as I guess you are getting it from server

Yes. XML structure is same, i’ve added excel application scope to write values becasue I’ve to make report available to business. Do you think there is another way to do it?

Yes, that would be the better option to do that. Even we have alternatives. but that is the best way

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.