Forum Discussion

alibaba82's avatar
alibaba82
Super Contributor
17 years ago

Xquery issue

Hello,
The Xquery description in the soapui manual says that the it
"resulting in an assertion that will not fail if the items come in another order and/or get more/other data "around" the id element"

However, I notice that when I get more elements than the ones defined in the list, my assertions fails. Not sure I am doing something wrong.

My xquery is

declare namespace ns1='.......hidden';

{
for $z in //ns1:GetRecommendationsResponse[1]/ns1:GetRecommendationsResult[1]/ns1:Airings[1]/ns1:Airing/ns1:AiringRating/text()
order by $z return {data($z)}
}


Expected Result:

  TV-14
  TV-14
  TV-14


Now if I get more or less than 3 airingsRatings my assertion fails with this error.

XQuery Match Assertion failed for path [declare namespace ns1='http://services.tvguide.com/v4/smartrecommendations';  { for $z in //ns1:GetRecommendationsResponse[1]/ns1:GetRecommendationsResult[1]/ns1:Airings[1]/ns1:Airing/ns1:AiringRating/text() order by $z return  {data($z)}  }  ] : Exception:org.custommonkey.xmlunit.Diff [different] Expected number of child nodes '7' but was '9' - comparing  at /ALI[1] to  at /ALI[1]


your input is appreciated.

Thanks

Ali
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Ali,

    sorry, the manual is a bit unclear I guess. What it means that data "outside" the selection of the XQuery statement will not affect the assertion, but new/additional content that matches the query will be included in the result for comparison.

    Or did I misunderstand your question?

    regards!

    /Ole
    eviware.com