Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

Comparing two xmls based on keys....

Question posted by: Nick (Guest) on June 27th, 2008 07:07 PM
Hi,

I need to compare two xml files. Which contain multiple xml datas
based on a key.

So for eg. I have two xmls A.xml and B.xml.

A.xml :
<?xml version="1.0" encoding="UTF-8"?>
<Test >
<Item>1</Item>
<Name>Orange</Name>
</Test>
<Test >
<Item>2</Item>
<Name>Apple</Name>
</Test>

Whereas B.xml :

<?xml version="1.0" encoding="UTF-8"?>
<Test >
<Item>2/Item>
<Name>Apple</Name>
</Test>
<Test >
<Item>1</Item>
<Name>Orange</Name>
</Test>

If you compare tags row by row then the xmls won't match but if you
keep the Item as the key then both the xmls are equal.
Item : 1 / Name : Orange
Item : 2 / Name : Apple

How can you do such comparison in Java

Cheers
Nick
 
Not the answer you were looking for? Post your question . . .
189,870 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors