Forum Discussion

v3t3a's avatar
v3t3a
Occasional Contributor
11 years ago
Solved

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
  • 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!

4 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    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.
  • v3t3a's avatar
    v3t3a
    Occasional Contributor
    Hi,

    Sorry for late response nmrao.

    I will try it soon.
    I had used another method...
  • v3t3a's avatar
    v3t3a
    Occasional Contributor
    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!