Soupui怎么使用Xpath Match
Soupui如何使用Xpath Match
webservice response如下:
soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<FinancialIndexConstituents_2_Standard_1_Response timeStamp="2013-08-20T11:14:01.9165743+08:00" xmlns="http://www.reuters.webservices.com/FinancialIndexConstituents_2_Standard_1">
<ResponseItem>
<Content>
<IndexRIC>.DJI</IndexRIC>
<Constituent pfi="BA.N" pfiType="RIC">Boeing</Constituent>
<DefaultSector pfi="2000090894" pfiType="INDUSTRY CLASSIFICATION BENCHMARK">Aerospace</DefaultSector>
<IndexShares>1</IndexShares>
<ChangeReason pfi="1000001230">Entered</ChangeReason>
<BeginDate>0094-01-01</BeginDate>
</Content>
。。。。。。。。。。。。。。。
<Content>
<IndexRIC>.DJI</IndexRIC>
<Constituent pfi="VZ.N" pfiType="RIC">Verizon</Constituent>
<DefaultSector pfi="2000091010" pfiType="INDUSTRY CLASSIFICATION BENCHMARK">Fixed Line Telecommunications</DefaultSector>
<IndexShares>1</IndexShares>
<ChangeReason pfi="1000001230">Entered</ChangeReason>
<BeginDate>0004-04-08</BeginDate>
</Content>
</ResponseItem>
</FinancialIndexConstituents_2_Standard_1_Response>
</soap:Body>
</soap:Envelope>
想加入一个断言,要求查看<Constituent pfi>的属性中有一个的值为 'BA.N'。可以使用contains,但是这样检查的是整个response。问题:如何精确到只查看<Constituent pfi>这个属性。用 Xpath Match能实现吗?如何实现?
------解决方案--------------------
//Content/Constituent[@pfi=BA.N]
webservice response如下:
soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<FinancialIndexConstituents_2_Standard_1_Response timeStamp="2013-08-20T11:14:01.9165743+08:00" xmlns="http://www.reuters.webservices.com/FinancialIndexConstituents_2_Standard_1">
<ResponseItem>
<Content>
<IndexRIC>.DJI</IndexRIC>
<Constituent pfi="BA.N" pfiType="RIC">Boeing</Constituent>
<DefaultSector pfi="2000090894" pfiType="INDUSTRY CLASSIFICATION BENCHMARK">Aerospace</DefaultSector>
<IndexShares>1</IndexShares>
<ChangeReason pfi="1000001230">Entered</ChangeReason>
<BeginDate>0094-01-01</BeginDate>
</Content>
。。。。。。。。。。。。。。。
<Content>
<IndexRIC>.DJI</IndexRIC>
<Constituent pfi="VZ.N" pfiType="RIC">Verizon</Constituent>
<DefaultSector pfi="2000091010" pfiType="INDUSTRY CLASSIFICATION BENCHMARK">Fixed Line Telecommunications</DefaultSector>
<IndexShares>1</IndexShares>
<ChangeReason pfi="1000001230">Entered</ChangeReason>
<BeginDate>0004-04-08</BeginDate>
</Content>
</ResponseItem>
</FinancialIndexConstituents_2_Standard_1_Response>
</soap:Body>
</soap:Envelope>
想加入一个断言,要求查看<Constituent pfi>的属性中有一个的值为 'BA.N'。可以使用contains,但是这样检查的是整个response。问题:如何精确到只查看<Constituent pfi>这个属性。用 Xpath Match能实现吗?如何实现?
------解决方案--------------------
//Content/Constituent[@pfi=BA.N]