Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

intersection of xml files

Status
Not open for further replies.

zalim30

Programmer
Oct 13, 2005
17
GB
hi
I want to find intersection of two xml files. i.e. if the operation should result only those nodes which are common in both files. Any ideas.
 
Do the nodes have to be the same depth? Do they have to have the same value?

Jon

"I don't regret this, but I both rue and lament it.
 
Hi jonty thanx for your reply. Let me show you what I want.
File1.xml
<?xml version="1.0"?>
<root>
<object ID ="1" name = "abc" price = "0"/>
<object ID ="2" name = "def" price = "430"/>
<object ID ="3" name = "abc" price = "350"/>
<object ID ="4" name = "def" price = "3000"/>
<object ID ="5" name = "jkl" price = "130"/>
<object ID ="6" name = "abc" price = "230"/>
</root>
****************************************************
File2.xml
<?xml version="1.0"?>
<root>
<object ID ="1" name = "abc" price = "0"/>
<object ID ="2" name = "def" price = "430"/>
<object ID ="4" name = "defijk" price = "3000"/>
<object ID ="50" name = "jkl" price = "130"/>
<object ID ="7" name = "abc" price = "2"/>
<object ID ="17" name = "xyz" price = "2"/>
</root>
***********************************************
result.xml
<?xml version="1.0"?>
<root>
<object ID ="1" name = "abc" price = "0"/>
<object ID ="2" name = "def" price = "430"/>
</root>

So as you can see, only those elements are retained whose attributes exactly matched in value...
I think that will help explain the problem....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top