如何使用 soap ui 5.3.0 的 groovy 脚本获取嵌套 xml 的特定响应数组中的所有标签
how to fetch all the tags in particular Response array for a nested xml using groovy script for soap ui 5.3.0
我想获取特定数组的所有值,我们该怎么做?
我使用了下面的,但它只读取第一个参数而不是数组的整个参数。
def ActualValue= resholder.getNodeValues("//*:Array1//*:"+context["parameter"]).toString()
特定数组中有 10 个参数,在获取第一个节点的值后,出现错误 "java.lang.nullpointerexception: Cannot invoke method contains () on null object"
<a:Bundle>
<a:Plans>
<a:Quotes>
<a:Quote>
<a:StandardBenefits>
<a:BenefitPeriod>
<a:Description i:nil="true"/>
<a:DisplayName i:nil="true"/>
<a:Value>6 months</a:Value>
</a:BenefitPeriod>
<a:Coinsurance>
<a:Description>50</a:Description>
<a:DisplayName i:nil="true"/>
<a:Value>50</a:Value>
</a:Coinsurance>
<a:OutOfPocket>
<a:Description>5000</a:Description>
<a:DisplayName i:nil="true"/>
<a:Value>5000</a:Value>
</a:OutOfPocket>
<a:PreventiveCare i:nil="true"/>
<a:Rx i:nil="true"/>
<a:StopLoss>
<a:Description i:nil="true"/>
<a:DisplayName i:nil="true"/>
<a:Value>10000</a:Value>
</a:StopLoss>
</a:StandardBenefits>
</a:Quote>
<a:Quote>
//similar data like above quote
</a:Quote>
</a:Quotes>
</a:Plans>
</a:Bundle>
"def ActualValue= resholder.getNodeValues("//:Array1//:"+context["parameter" ])"
使用上面的代码,检索数组的所有标签值
我想获取特定数组的所有值,我们该怎么做?
我使用了下面的,但它只读取第一个参数而不是数组的整个参数。
def ActualValue= resholder.getNodeValues("//*:Array1//*:"+context["parameter"]).toString()
特定数组中有 10 个参数,在获取第一个节点的值后,出现错误 "java.lang.nullpointerexception: Cannot invoke method contains () on null object"
<a:Bundle>
<a:Plans>
<a:Quotes>
<a:Quote>
<a:StandardBenefits>
<a:BenefitPeriod>
<a:Description i:nil="true"/>
<a:DisplayName i:nil="true"/>
<a:Value>6 months</a:Value>
</a:BenefitPeriod>
<a:Coinsurance>
<a:Description>50</a:Description>
<a:DisplayName i:nil="true"/>
<a:Value>50</a:Value>
</a:Coinsurance>
<a:OutOfPocket>
<a:Description>5000</a:Description>
<a:DisplayName i:nil="true"/>
<a:Value>5000</a:Value>
</a:OutOfPocket>
<a:PreventiveCare i:nil="true"/>
<a:Rx i:nil="true"/>
<a:StopLoss>
<a:Description i:nil="true"/>
<a:DisplayName i:nil="true"/>
<a:Value>10000</a:Value>
</a:StopLoss>
</a:StandardBenefits>
</a:Quote>
<a:Quote>
//similar data like above quote
</a:Quote>
</a:Quotes>
</a:Plans>
</a:Bundle>
"def ActualValue= resholder.getNodeValues("//:Array1//:"+context["parameter" ])"
使用上面的代码,检索数组的所有标签值