JMalvin
12 years agoOccasional Contributor
Using Properties in XPath Expression Match
Hi,
I need to know if it is possible to use properties in the XPath Match Configuration. I know it is possible to use it in the "Expected Result" panel, but when I use a property in "XPath Expression", I get "Exception:Missing content for xpath" error.
I have multiple occurrence of same XML block that I need to drill down based on an element's sibling value, i.e.:
I am checking to see, for example, there is a //Jins/JinType that its value is 'N' given that //Jins/Jin is 'CX'. If there is at least such construct, then match should occur. However, the value of Jin, in this case, 'CX', comes from a datasource. Therefore, I was hoping I can construct something like:
XPath Expression
Expected Result
But executing above Xpath Match Configuration would result in "Exception:Missing content for xpath" error. If I take out "${DataSourceValues#JIN}" and hard code the exact value, it works. Is there a way to use properties in XPath Expression panel? Or is there another way of accomplishing the same thing with other methods in SoapUI?
Thanks.
I need to know if it is possible to use properties in the XPath Match Configuration. I know it is possible to use it in the "Expected Result" panel, but when I use a property in "XPath Expression", I get "Exception:Missing content for xpath" error.
I have multiple occurrence of same XML block that I need to drill down based on an element's sibling value, i.e.:
<ns3:Jins>
<ns3:Jin>CF</ns3:Jin>
<ns3:JinType>V</ns3:JinType>
<ns3:StartDate>2001-11-02-06:00</ns3:StartDate>
</ns3:Jins>
<ns3:Jins>
<ns3:Jin>CT</ns3:Jin>
<ns3:JinType>T</ns3:JinType>
<ns3:StartDate>2001-11-02-06:00</ns3:StartDate>
</ns3:Jins>
<ns3:Jins>
<ns3:Jin>CX</ns3:Jin>
<ns3:JinType>N</ns3:JinType>
<ns3:StartDate>2001-11-02-06:00</ns3:StartDate>
</ns3:Jins>
I am checking to see, for example, there is a //Jins/JinType that its value is 'N' given that //Jins/Jin is 'CX'. If there is at least such construct, then match should occur. However, the value of Jin, in this case, 'CX', comes from a datasource. Therefore, I was hoping I can construct something like:
XPath Expression
declare namespace ns3='http://my.namespace';
//ns3:Jins/ns3:JinType[../ns3:Jin[text()=${DataSourceValues#JIN}]]/text()
Expected Result
${DataSourceValues#JIN_TYPE}
But executing above Xpath Match Configuration would result in "Exception:Missing content for xpath" error. If I take out "${DataSourceValues#JIN}" and hard code the exact value, it works. Is there a way to use properties in XPath Expression panel? Or is there another way of accomplishing the same thing with other methods in SoapUI?
Thanks.