What is the best way to compare XML files for equality?

前端 未结 7 1288
春和景丽
春和景丽 2020-12-20 12:59

I\'m using .NET 2.0, and a recent code change has invalidated my previous Assert.AreEqual call (which compared two strings of XML). Only one element of the XML is actually

7条回答
  •  轮回少年
    2020-12-20 13:14

    Doing a simple string compare on a xml string not always work. Why ?

    for example both :

    and are equal from an xml standpoint ..

    There are algorithms for converting making an xml always look the same, they are called canonicalization algorithms. .Net has support for canonicalization.

提交回复
热议问题