I have a xml that I need to shred. But I am getting this error XQuery [nodes()]: The name "s" does not denote a namespace.
I have xml in following format
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">urn:somename-com:Access.2012.Services.Patient.GetCensus</a:Action>
</s:Header>
<s:Body>
<GetCensusByUnitResponse xmlns="urn:somename-com:Access.2012.Services.Patient">
<GetCensusByUnitResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<BeddedPatients>
<BeddedPatient>
...
...
...
</GetCensusByUnitResult>
</GetCensusByUnitResponse>
</s:Body>
</s:Envelope>
;with xmlnamespaces('urn:Epic-com:Access.2012.Services.Patient' as ep,
'http://www.w3.org/2003/05/soap-envelope' as s,
'http://www.w3.org/2005/08/addressing' as a,
'http://www.w3.org/2001/XMLSchema-instance' as i)
But when try to shred it using xquery it gives me the error.
To shred i have written following query:
select x.n.value('(ep:AccommodationCode)[1]', 'varchar(128)') as accomdationCode
from @xml.nodes('/s:Envelope/s:Body/ep:GetCensusByUnitReeponse/ep:GetCensusByUnitResult/ep:BeddedPatients/ep:BeddedPatient') x(n)
Can somebody suggest me what might be problem? Thanks in advance.