更新时间:2022-11-17 15:41:23
以下测试通过了相似"检查,但未通过相同"检查:
The following test passes the "similar" check but fails the "identical" check:
String control = "<prefix1:element xmlns:prefix1=\"namespace\" prefix1:attribute=\"x\">Some text</prefix1:element>";
String test = "<prefix2:element xmlns:prefix2=\"namespace\" prefix2:attribute=\"x\">Some text</prefix2:element>";
try
{
Diff diff = XMLUnit.compareXML( control, test );
assertTrue( "Similar", diff.similar() );
assertTrue( "Identical", diff.identical() );
}
catch ( Exception e )
{
fail( e.getMessage() );
}
从xmlunit API文档中:
From the xmlunit API docs:
因此,使用相似"检查应该可以为您提供所需的信息.
So using the "similar" check should give you what you want.
添加了前缀属性,结果相同.
added prefixed attributes, same result.