My input xml
<namelist>
<order>
<name>JAMES</name>
<accNo>10D</accNo>
</order>
<order>
<name>ARAFAT</name>
<accNo>07A</accNo>
</order>
<order>
<name>anotherbranchaccount</name>
<accNo>20J</accNo>
</order>
<order>
<name>JAMES</name>
<accNo>20K</accNo>
</order>
<order>
<name>JOHN</name>
<accNo>9A</accNo>
</order>
<order>
<name>anotherbranchaccount</name>
<accNo>10E</accNo>
</order>
</namelist>
Expected output
JAMES 10D ANOTHERACCOUNT 10E
ARAFAT 07A
JAMES 20K ANOTHERACCOUNT 20J
My problem
I got to match with 'anotherbranchaccount'element which 'accNo' is adjacent to JAMES 'accNo' .There is no sequence like main account number then extra account node. Give me solution. I dont have any idea about finding from alphanumeric format.because we have many alphanumeric comibanations like [A-Z][1 TO 100] How to solve this issue? Please help me out.