This is a small part the xml file that I have:
<Prop Type='TEResult' Flags='0x0'>
<Prop Name='Status' Type='String' Flags='0x400000'>
<Value>Done</Value>
</Prop>
<Prop Name='StepName' Type='String' Flags='0x0'>
<Value>Scan CPU Serial Number</Value>
</Prop>
</Prop>
Now this small xml code repeats numerously throughout my xml file.I want to go through the entire xml file and extract the values (which are Done and Scan CPU Serial Number in this case) of all Prop with Name='Status' and Name='StepName'.
My output needs to look like this
<TestName>Scan CPU Serial Number</TestName>
<TestResult>Done</TestResult>
I am using nested for each statements and this is the output it is giving me:
<TestName>Scan CPU Serial Number>
<TestResult>Done</TestResult>
<TestResult>Done</TestResult> (2)
<TestResult>Done</TestResult>
<TestResult>Done</TestResult>
<TestResult>Done</TestResult>
<TestResult>Done</TestResult>
<TestResult>Done</TestResult>
<TestResult>Done</TestResult>
<TestResult>Done</TestResult>
<TestName><This is the next test></TestName>
What essentially should be happening is that Result( 2) should come below my next <TestName> but because of my nested for each loops, it goes through the entire xml file, prints all the results and then goes back to the next test, then again all the results instead of <Test><Its Result> <Test><Its Result>?
How can I solve this?