开发者

How to validate two xml files are similar (but ignore the element and attribute order)?

开发者 https://www.devze.com 2023-02-21 23:35 出处:网络
For the purposes of unit testing, I would like to validate开发者_Python百科 that two xml files contain the same data, but ignore the order of the elements or attributes.

For the purposes of unit testing, I would like to validate开发者_Python百科 that two xml files contain the same data, but ignore the order of the elements or attributes.

I am currently using MbUnit.Framework.Xml.XmlAssert.XmlEquals, and it seems to have a few options but I can't find any documentation. It returns false if the element order is different.

This is a c# project.


Try using Microsoft's XML Diff and Patch Tool.

In addition to the XML Diff and Patch API, you may be interested in taking a look at the Windows Forms code sample that implements the tool - XML Diff and Patch GUI Tool (The API's dll is included in this download).


A while back I was happily using xmlunit for these kinds of problems, http://xmlunit.sourceforge.net/, not sure about the .net side of it, or if it is still kept uptodate &c.

0

精彩评论

暂无评论...
验证码 换一张
取 消