Why won't xquery recognize this data?


below snippet untyped xml in an xml field of my sql server 2005 db:

 

<asdioutput xmlns=http://namespace1 xmlns:nxce=http://namespace2 xmlns:mmd=http://namespace3 xmlns:nxcm="namespace4" xmlns:xsi="http://www.w3.org/2001/xmlschema"timestamp="2007-05-03t17:55:02.0z">

<asdimessage source="kzbw" sourcetimestamp="2007-05-03t17:54:38.0z" trigger="fa">

<managementinformation>

<nxcm:qualifiedid>

<nxce:id>chq6340</nxce:id>

<nxce:computerid>

<nxce:idnumber>191</nxce:idnumber>

</nxce:computerid>

</nxcm:qualifiedid>

</managementinformation>

</asdimessage>

</asdioutput>

 

code block

select [xmldata].query('

declare namespace nxce="http://namespace2";

//nxce:id') as result

from feeddata

 

 

i results.

 

when execute query:

code block

select [xmldata].query('//asdimessage') as result

from feeddata

 

 

i nothing. thoughts?  realize there's no namespace asdimessage, don't know how xquery recognize tag.

 

thanks

another option (nicer results):

 

code block

select [xmldata].query('declare default element namespace "http://namespace1" ;

declare namespace nxce="http://namespace2";

declare namespace mmd="http://namespace3";

declare namespace nxcm="namespace4";

declare namespace xsi="http://www.w3.org/2001/xmlschema";

//asdimessage') as result

from feeddata

 

 

 



SQL Server  >  SQL Server XML



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

How to send non-standard Content-Type header ?