我尝试将两个 xml 与 xmlUnit 进行比较。我有以下问题。当我有两个空元素时,如下例 xmlUnit 将元素标识为差异。我可以将 xmlUnit 配置为忽略这个吗?
</name>
和<name></name>
我只对下面两个例子的差异感兴趣。
<name>test1</name>
和<name>test2</name>
区别:test1 和 test2
或者
<name>test1</name>
和<name></name>
差异 test1 和 ...
我的代码:
`
Diff diff = new Diff(fr1, fr2);
DetailedDiff detailedDiff = new DetailedDiff(diff);
List differenceList = detailedDiff.getAllDifferences();
List differences = detailedDiff.getAllDifferences();
for (Object object : differences) {
Difference difference = (Difference)object;
String node1;
String node2;
node1 = difference.getControlNodeDetail().getNode().getNodeName() + " " + difference.getControlNodeDetail().getNode().getNodeValue();
node2 = difference.getTestNodeDetail().getNode().getNodeName() + " " + difference.getTestNodeDetail().getNode().getNodeValue();
}
`