Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

compare the two xml files attributes, elements & sub elements

 
ashok ks
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can i compare two xml files attributes, elements & sub elements ?
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What exactly do you mean by "comparing"?
Is it enough to know whether two documents are identical, similar or different, or do you need to know *what* is different between two documents?
The former requirement would be easy to satisfy with XMLUnit.
 
ashok ks
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to know about *what* is different between two documents details also.
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ashok ks:
I would like to know about *what* is different between two documents details also.

Just wondering why ??
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In fact, XMLUnit provides a class named DetailedDiff which can list detailed differences between two documents.
Here's some sample code:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic