【发布时间】:2013-11-08 08:45:01
【问题描述】:
我有一个需要粉碎的 xml。但我收到此错误XQuery [nodes()]: The name "s" does not denote a namespace.
我有以下格式的xml
<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)
但是当尝试使用 xquery 将其切碎时,它给了我错误。
为了粉碎我写了以下查询:
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)
有人可以建议我可能有什么问题吗?提前致谢。
【问题讨论】:
标签: xml sql-server-2008 xquery xquery-sql