I'm testing the SelectSingleNode
function to fetch a single node from an XMLNode object in Visual Studio as follows:
Dim nsmgr As XmlNamespaceManager = New XmlNamespaceManager(xmlDoc.NameTable)
nsmgr.AddNamespace(ndListItems.Prefix, ndListItems.NamespaceURI)
Dim dummy As XmlNode = ndListItems.SelectSingleNode("/listitems", nsmgr)
At this point, I'm just trying to get the root node and I'm using the prefix and namespaceURI property to add to the XmlNamespaceManager
. Problem is that when I run the debugger the dummy variable is not being assigned, i.e it is Nothing. Just to note, when I analyze the values of the Prefix and namespace property they are as follows, Prefix="" and NamespaceURI="http://schemas.microsoft.com/sharepoint/soap"
UPDATE:
Tried changing the code, but my dummy XMLNode is still not getting set
Dim nsmgr As XmlNamespaceManager = New XmlNamespaceManager(xmlDoc.NameTable)
nsmgr.AddNamespace(ndListItems.Prefix, ndListItems.NamespaceURI)
Dim dummy As XmlNode = ndListItems.SelectSingleNode("/" + ndListItems.Prefix + "listitems", nsmgr)
Here is the XML code snippet of what I'm trying to get, my ultimate goal is to access the attributes of the z:row node
<listitems xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<rs:data ItemCount="1">
<z:row ows_Title="Newhire" ows_FirstName="Rick" ows_WorkPhone="954" ows_HomePhone="954" ows_Email="[email protected]" ows_UserID="Rick.Newhire" ows_MetaInfo="9;#" ows__ModerationStatus="0" ows__Level="1" ows_ID="9" ows_owshiddenversion="1" ows_UniqueId="9;#{0F6251A9-D3B8-4B07-A5F8-23BAF5F2237E}" ows_FSObjType="9;#0" ows_Created="2010-08-18 15:56:40" ows_FileRef="9;#Lists/NewHires/9_.000" />
</rs:data>
</listitems>