11 years ago
Comparing the two xml responses when the order is different
Hi
I need to compare two xml responses using groovy script, two xml responses are having array loops. I am able to compare one to one mapping using groovy , but order is coming differently in both the responses.
It would be great if some body help me in doing this ,
Example given below
RESPONSE1:
<RecordDetails>
<Record>
<Name>sam</Name>
<Price>1.20</Price>
</Record>
<Record>
<Name>David</Name>
<Price>4.30</Price>
</Record>
<Record>
<Name>George</Name>
<Price>3.20</Price>
</Record>
</RecordDetails>
RESPONSE 2:
<RecordDetails>
<Record>
<Name>David</Name>
<Price>4.30</Price>
</Record>
<Record>
<Name>George</Name>
<Price>3.20</Price>
</Record>
<Record>
<Name>sam</Name>
<Price>1.20</Price>
</Record>
</RecordDetails>
Regards,
kkumar
I need to compare two xml responses using groovy script, two xml responses are having array loops. I am able to compare one to one mapping using groovy , but order is coming differently in both the responses.
It would be great if some body help me in doing this ,
Example given below
RESPONSE1:
<RecordDetails>
<Record>
<Name>sam</Name>
<Price>1.20</Price>
</Record>
<Record>
<Name>David</Name>
<Price>4.30</Price>
</Record>
<Record>
<Name>George</Name>
<Price>3.20</Price>
</Record>
</RecordDetails>
RESPONSE 2:
<RecordDetails>
<Record>
<Name>David</Name>
<Price>4.30</Price>
</Record>
<Record>
<Name>George</Name>
<Price>3.20</Price>
</Record>
<Record>
<Name>sam</Name>
<Price>1.20</Price>
</Record>
</RecordDetails>
Regards,
kkumar