How to compare a node value in one xml to similar nodes in another xml
I have 2 XMLs and need to compare the node values.
XML1 has 4 firstname and 4 last name node and same with XML2 but both are not in same order.
I need to make sure that all the 4 names in XML1 match with all 4 in XML2 ( if not first element then looping through remining)
I have tried getNodeValues and am getting the values but not sure on comaparing them.
Can someone please help me as am new to groovy and this is very confusing for me
Solved! Go to Solution.
xml1 and xml 2 same format
now I need to take the values for xml1 (desc and date combination from inc ) and compare it to all same fields in xml 2. abc-111 combination on xml1 is the first inc of the xml1 but it need not be the first in the xml2.
similarly I can have multiple Inc in one xml and need to compare all of them to match on the second and provide pass whenever it matches. if it matches on the first -first combination, then I need to start searching for second Inc on xml 2. if this is not in second place on xml2, I need to search all the remainiung Inc
The desc can be repaeating for multiple Inc
Should come something like:
xml1 = [ [desc: 'abc', date: '111'], [desc: 'def', date:'222']]
xml2 should also be same.