ramoh
ramoh

Reputation: 153

Comparing two instances of XML for changes

I have a requirement where i want to keep/track changes to base XML document . For this i have to figure out a most efficient way to keep track of all the changes done to the base XML structure and keep those changes in a different fomat(xml). My input source can be of both type that is SAX and DOM .How can I achieve this ?

Upvotes: 1

Views: 198

Answers (2)

Michael Kay
Michael Kay

Reputation: 163342

A commercial product that probably does everything you want in the area of XML differencing is DeltaXML.

Upvotes: 1

prunge
prunge

Reputation: 23248

XMLUnit has exactly this functionality:

XMLTestCase.compareXML() has both DOM and SAX versions. Use DetailedDiff to get a list of all differences between the two XMLs. Convert this diff object to your own representation if needed.

XMLUnit is nice because it can treat similar XML documents (such as whitespace, sibling order, namespace prefixes) as the same if you want.

Upvotes: 4

Related Questions