问题描述
我必须进行 2 个不同的测试,第一个是
场景 1. 比较 2 个 XML(我没有可能的模式),考虑到某些列表节点/标签可能处于不同的顺序,并在日志中显示是否有任何差异或额外节点。
场景 2 - 我有一个小型 XML 服务响应,我必须验证此响应是否正确显示在具有太多节点的通用 XML 文件中。考虑到某些列表节点/标签可能处于不同的顺序,我必须说明在某些错误存在不同值或错误结构的情况下有什么区别。
例如。对于场景 2。
要验证为通用 XML 的 XML1 服务响应
<dinner_menu>
<food>
<name>Burrito</name>
<price>$1.95</price>
<description>Tortilla,avocado,beans,meat,cream</description>
<calories>200</calories>
</food>
<food>
<name>Mexican Tacos</name>
<price>$6.95</price>
<description>Order of 5 Mexican Tacos</description>
<calories>450</calories>
</food>
</dinner_menu>
XML2 通用 XML,其中节点存在但顺序不同(这没问题,但墨西哥 taco 价格节点中有一个错误)
<AllServicesResponses>
<Service1Restaurant>
<breakfast_menu>
<food>
<name>Belgian Waffles</name>
<price>$5.95</price>
<description>Two of our famous Belgian Waffles with plenty of real maple syrup</description>
<calories>650</calories>
</food>
<food>
<name>StrawBerry Belgian Waffles</name>
<price>$7.95</price>
<description>Light Belgian waffles covered with strawberries and whipped cream</description>
<calories>900</calories>
</food>
<food>
<name>Berry-Berry Belgian Waffles</name>
<price>$8.95</price>
<description>Light Belgian waffles covered with an assortment of fresh berries </description>
<calories>900</calories>
</food>
</breakfast_menu>
<dinner_menu>
<food>
<name>Mexican Tacos</name>
<calories>450</calories>
<price>$8.50</prce>
<description>Order of 5 Mexican Tacos</description>
</food>
<food>
<name>Burrito</name>
<price>$1.95</price>
<description>Tortilla,cream</description>
<calories>200</calories>
</food>
</dinner_menu>
</Service1Restaurant1>
<Service2Response>
.<Node1></Node1>
.
.
</Service2Response>
<Service3Response>
.<Node1></Node1>
.
.
</Service3Response>
</AllServicesResponses>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)