cancel
Showing results for 
Search instead for 
Did you mean: 

Xquery or Xpath with mutiple results

SOLVED
v3t3a
Occasional Contributor

Xquery or Xpath with mutiple results

Hi everybody,

I just have a simply question (i don't find any response... sorry if it already exist) :
- Is it possible to return multiple values for a Xquery request or a Xpath expression?

I know that it's normally supported by Xquery or Xpath match, but with SoapUi, i always have the knowing message : 😠 "more than one row match in current response" 😠 .

-----------------
Example : Just try this simply Xquery request :

for $x in (1 to 5)
return <test>{$x}</test>

-----------------

Thanks in advance,


v3t3a
1 ACCEPTED SOLUTION

Accepted Solutions
v3t3a
Occasional Contributor

Re: Xquery or Xpath with mutiple results

It works with the follow query :

declare namespace soap='http://schemas.xmlsoap.org/soap/envelope/';
declare namespace ns1='http://echange.service.xxx.xxx.com';
<Result>
{
for $x in //ns1:exportAbsenceRequestsListResponse/ns1:exportedAbsenceRequests/ns1:AbsenceRequest
return<a>{data($x/ns1:employeeKey/text())}</a>
}
</Result>


Thanks!

View solution in original post

4 REPLIES 4
nmrao
Community Hero

Re: Xquery or Xpath with mutiple results

Assertion is meant for the matching of the result with an expected out.

Here is what I believe.

In your case you might be getting, which may giving the error message
<test>1</test>
<test>2</test>
<test>3</test>
<test>4</test>
<test>5</test>

May be you could try achieving the output as below which may be valid
<someElement>
<test>1</test>
<test>2</test>
<test>3</test>
<test>4</test>
<test>5</test>
</someElement>

Note that I haven't tried.


Regards,
Rao.
v3t3a
Occasional Contributor

Re: Xquery or Xpath with mutiple results

Hi,

Sorry for late response nmrao.

I will try it soon.
I had used another method...
nmrao
Community Hero

Re: Xquery or Xpath with mutiple results

Have you tried?


Regards,
Rao.
v3t3a
Occasional Contributor

Re: Xquery or Xpath with mutiple results

It works with the follow query :

declare namespace soap='http://schemas.xmlsoap.org/soap/envelope/';
declare namespace ns1='http://echange.service.xxx.xxx.com';
<Result>
{
for $x in //ns1:exportAbsenceRequestsListResponse/ns1:exportedAbsenceRequests/ns1:AbsenceRequest
return<a>{data($x/ns1:employeeKey/text())}</a>
}
</Result>


Thanks!

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements