I’m working on a project that includes comparing XML files and I need a source code on Java to compare XML fragments.
I’m using ExamXML from http://www.a7soft.com to compare XML files but I need the Java source code.
The comparator that I wrote gives you the flexibility to configure how to identify a node from a set of repeated nodes and is able to compare them successfully if they occur in any order. You can send a message via http://www.cityhaat.com/adAction.do?dispatchMethod=viewAd&adId=291 this link if you need customizations for your comparisons. Its FREE.
for similar project I used DOM. It is not very difficult to do once you give a try. Besides, xml diff tools may not be very effective as it doesn't know how flexible you want to be. So instead of looking for others code, you better consider reading some introductory DOM parsing, get the nodes information, compare each other, and get your own diff tool. One example for starting your reading can be: http://www.onjava.com/pub/a/onjava/2001/02/08/dom.html
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...