我有5辆车,每辆车有5个车主,我需要返回那些国家没有出现在其他车主中的车主(可以出现在同一辆车的车主中):
<root>
<car>
<id>1</id>
<owner>
<name>George Smith</name>
<nation>USA</nation>
</owner>
<owner>
<name>Carolina Herre</name>
<nation>USA</nation>
</owner>
<owner>
<name>Martha Belar</name>
<nation>Denmark</nation>
</owner>
<owner>
<name>Fernando Izza</name>
<nation>Italy</nation>
</owner>
<owner>
<name>George Smith</name>
<nation>Italy</nation>
</owner>
</car>
<car>
<id>2</id>
<owner>
<name>George Gelar</name>
<nation>USA</nation>
</owner>
<owner>
<name>Gema Bio</name>
<nation>Spain</nation>
</owner>
<owner>
<name>Peter Vdf</name>
<nation>Denmark</nation>
</owner>
<owner>
<name>Felipe Rodriguez</name>
<nation>Denmark</nation>
</owner>
<owner>
<name>George Smith</name>
<nation>USA</nation>
</owner>
</car>
<car>
...
</car>
<car>
...
</car>
<car>
...
</car>
</root>
也就是说,给定 xml,输出将是:
<owner>
<name>Fernando Izza</name>
<nation>Italy</nation>
<carID>1</carID>
</owner>
<owner>
<name>George Smith</name>
<nation>Italy</nation>
<carID>1</carID>
</owner>
<owner>
<name>Gema Bio</name>
<nation>Spain</nation>
<carID>2</carID>
</owner>
我试图获取没有出现在几辆汽车中的国家列表,然后获取来自这些国家的那些车主,但我不知道如何获取。