I have an XML document that looks like this. It may be that it’s invalid (I didn’t create it!)
<ns:url xmlns:ns="http://www.urlone.com/" xmlns:news="http://www.urltwo.com/">
.. node tree
</ns:url>
I need to build a T-SQL Query to extract the value of the xmlns:news attribute and update it. This requires XPath. But all the queries I’ve attempted so far fail with an error similar to:
XPath expression uses unbound namespace prefix xmlns
Is is possible to select and update this node given the XML format? If so, how?
Cheers,
Matt
To get the value you can use the OPENXML edge table.
I don’t know of a way to update the URL other than recreating the XML or to use string manipulation.