I have following XML:
<Loop Name="MasterData">
<Loop Name="SlaveData">
<Segment Name="AAA">
<Node1>hello</Node1>
<Node2>john</Node2>
<Node3>hi</Node3>
<Node4>marry</Node4>
</Segment>
<Segment Name="BBB">
<Node1>00</Node1>
<Node2> </Node2>
<Node3>00</Node3>
<Node4> </Node4>
</Segment>
</Loop>
</Loop>
I have to read value of each Node i.e, Node1, Node2, Node3, Node4 which are under Segment node whose attribute ie Name = "AAA"
. How can I do this. I am referring following link from stackoverflow but thats not working for me.
How to read attribute value from XmlNode in C#?
I need output like this
Lets I have four sting variables strNode1, strNode2, strNode3, strNode4
. I want to store values in above four variables like following
strNode1 = "hello"
strNode2 = "john"
strNode3 = "hi"
strNode4 = "marry"