本文介绍了空手道:匹配xml中的重复元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试匹配xml中的重复元素以使模式空手道.
I'm trying to match a repeating element in a xml to karate schema.
XML消息
* def xmlResponse = """ <Envelope> <Header/> <Body> <Response> <Customer> <keys> <primaryKey>1111111</primaryKey> </keys> <simplePay>false</simplePay> </Customer> <serviceGroupList> <serviceGroup> <name>XXXX</name> <count>1</count> <parentName>DDDDD</parentName> <pendingCount>0</pendingCount> <pendingHWSum>0.00</pendingHWSum> </serviceGroup> <serviceGroup> <name>ZZZZZ</name> <count>0</count> <parentName/> <pendingCount>3</pendingCount> <pendingHWSum>399.00</pendingHWSum> </serviceGroup> </serviceGroupList> </Response> </Body> </Envelope> """我想将每个空手道模式都与之匹配
I want to match each with following karate schema
Given def serviceGroupItem = """ <serviceGroup> <name>##string</name> <count>##string</count> <parentName>##string</parentName> <pendingCount>##string</pendingCount> <pendingHWSum>##string</pendingHWSum> </serviceGroup> """这就是我尝试的方式
* xml serviceGroupListItems = get xmlResponse //serviceGroupList * match each serviceGroupListItems == serviceGroupItem但是它不起作用.知道如何使它起作用
But it doesn't work. Any idea how can I make it work
推荐答案您必须匹配每个serviceGroup.
You have to match each serviceGroup.
* xml serviceGroupListItems = get xmlResponse //serviceGroupList * match each serviceGroupListItems.serviceGroupList.serviceGroup == serviceGroupItem.serviceGroup更多推荐
空手道:匹配xml中的重复元素
发布评论