aspose file tools*
The moose likes XML and Related Technologies and the fly likes Compare Two DOM Objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Compare Two DOM Objects" Watch "Compare Two DOM Objects" New topic
Author

Compare Two DOM Objects

Rajesh Savitri
Greenhorn

Joined: Sep 13, 2002
Posts: 21
Hi,
I have two Dom objects from two different xml docs. Both the xml docs are of same Schema. But the contents of the two objects could be Same/Diff/Node might be in diff order. I need to compare these two objects and identify if they are same or diff. Can Some one tell me the best approach for this.
eg:
<root>
<node1/>
<node2/>
</root>
<root>
<node2/>
<node1/>
</root>
Even though the nodes 1 and 2 are in diff order the data are similar in these two xml docs. So when I compare the result shd be "Both xml docs are equal"
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
I think you should check if <XmlUnit/> would have a suitable API for your needs.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Rajesh Savitri
Greenhorn

Joined: Sep 13, 2002
Posts: 21
Thanks a lot...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Compare Two DOM Objects