0
Answer

compare xml file

rendy jaya

rendy jaya

12y
1k
1
hi, 

i want to ask how to compare 2 xml node in different xml file. 
for example like this, 
first xml file i have like this,
<create>
<capabilities>
<capability name="brand_name" value="Toyota" />
<capability name="model_name" value="Avanza" />
<capability name="series" value="AB32" />
<capability name="p_method" value="manual" />
<capability name="p_method" value="automatic" />
</capabilities> 
</create>                                                                                                                        

and for the second xml file, i have like this,

<Query>
<ItemTypeName>AndroidGame Toyota Avanza</ItemTypeName>
<UserAgent>blalal32123123</UserAgent>
</Query>
<Query>
<ItemTypeName>AndroidGame Toyota Avanza 2.0</ItemTypeName>
<UserAgent> olaolalalallalalalaa </UserAgent>
</Query>


and i want know how to compare between node, i mean for second xml file in first node itemtypename androidgame toyota avanza if have the same value with the first xml file 
<capability name="brand_name" value="Toyota" />
<capability name="model_name" value="Avanza" />


and the final result like this

<create>
<capabilities>
<capability name="brand_name" value="Toyota" />
<capability name="model_name" value="Avanza" />
<capability name="series" value="AB32" />
<capability name="p_method" value="manual" />
<capability name="p_method" value="automatic" />

<capability name="useragent" value=" blalal32123123 " /> // this is from second xml file
</capabilities> 
</create>  

anyone can help me for this? i really need. thanks