Ask a Question

Getting error for xQuery

SOLVED
techva
New Contributor

Getting error for xQuery

Hi, I have a very simple xQuery Assertion:

 

declare namespace soap='http://schemas.xmlsoap.org/soap/envelope/';
declare namespace ns1='http://www.webservicex.net/';
<resultData>
{
for $x in //ns1:SupplierData
return $x
}
</resultData>

 

I am getting the following error:

XQuery Match Assertion failed for path [declare namespace soap='http://schemas.xmlsoap.org/soap/envelope/'; declare namespace ns1='http://www.webservicex.net/'; { for $x in //ns1:SupplierData return $x } ] : Exception:org.custommonkey.xmlunit.Diff [different] Expected namespace URI 'null' but was 'http://www.webservicex.net/' - comparing at /resultData[1]/SupplierData[1] to at /resultData[1]/SupplierData[1]

 

My expected result is:

<resultData>
<SupplierData>
<SupplierNumber>0230740001</SupplierNumber>
<CompanyName>DR WILLIAM B HUTCHESON &amp; ASSOC OPTOME</CompanyName>
<Address1>112 ELDEN ST</Address1>
<Address2>STE C</Address2>
<City>HERNDON</City>
<Zip>VA</Zip>

...

 

2 REPLIES 2
PaulMS
Super Contributor

Is the namespace missing for SupplierData in the expected result?

To check that, I usually click the Select from current button under Expected Result to see the XQuery expression result from the current message.

techva
New Contributor

Thanks Paul. I also fount that out yesterday. Here's a snippet of how the expected result should like in case anyone else have this problem:

 

<resultData>
<SupplierData xmlns="http://www.webservicex.net/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SupplierNumber>0230740001</SupplierNumber>
<CompanyName>DR WILLIAM B HUTCHESON &amp; ASSOC...

cancel
Showing results for 
Search instead for 
Did you mean: