Naveen
Naveen

Reputation: 45

Which is the best way to compare two xml's where the data inside them is reordered?

I have two xmls where the data inside them is reordered and i want to compare them . Can anyone suggest any tool available ?

Upvotes: 1

Views: 866

Answers (1)

cowls
cowls

Reputation: 24344

Assuming you mean the data inside is different order and you want to compare the files but disregard the order differences..

One options is to run an XSL transformation on both XML files to reorder the nodes based on a sub node. Then run the comparison on the results of the transformation.

You can use the xsl:sort function to do the reordering:

An example of which can be found here: xsl:sort with apply-templates not sorting

Upvotes: 2

Related Questions