空手道:匹配xml中的重复元素

编程入门 行业动态 更新时间:2024-10-11 11:16:20
本文介绍了空手道:匹配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中的重复元素

本文发布于:2023-11-11 05:16:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1577479.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:空手道   元素   xml

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!