Reputation: 69
Below is a sample response from Jmeter tool
<ns2:Attribute Name="GUID" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
<ns2:AttributeValue>8b0f3dfe-21d3-1035-a063-f6571edcc101</ns2:AttributeValue>
</ns2:Attribute>
<ns2:Attribute Name="SCODES" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
<ns2:AttributeValue>S0336492^S0309824</ns2:AttributeValue>
</ns2:Attribute>
<ns2:Attribute Name="MODE" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
<ns2:AttributeValue>2</ns2:AttributeValue>
</ns2:Attribute>
</ns2:AttributeStatement>
I need to extract "AttributeValue>2" from the response. Tried using regex but that isn't working here. Can we do it with xpath extractor? Any help would be appreciated.
Upvotes: 1
Views: 1479
Reputation: 168002
Disclaimer: the below XPath query isn't guaranteed to work as I need to see full response, next time please provide as much information as you can:
Using local-name function like:
//*[local-name()='Attribute']/text()='MODE'/child::*/text()
Using XPath Namespaces functionality:
ns2
namespace under namespaces.config file (lives in the "bin" folder of your JMeter installation)you should be able to use the following XPath query
//Attribute[@Name='MODE']/AttributeValue/text()
See Using the XPath Extractor in JMeter guide for more information.
Upvotes: 1