Try the following:
nodeListTable[0].SelectNodes("./ns0:*",coverLetterSectionTemplateMamespaceManager)
The period selects the current node, so this expression will select all
"ns0:*" nodes that are children of the current node.
BTW, you don't have to use SelectNodes() at all. Since nodeListTable[0]
already return a single node, why don't you just use that node's child node
collection. For your XML sample document below
nodeListTable[0].FirstChild
will also give you what you need.
--
Kai Brinkmann [MSFT]
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
[quoted text, click to view] "helpful sql" <nospam@stopspam.com> wrote in message
news:epfhDS9WFHA.228@TK2MSFTNGP12.phx.gbl...
> Hi all,
> Following is a sample code from my xml file.
>
> <w:body>
> <ns0:Mpi>
> <ns0:User>
> <ns0:Address1>
>
> </ns0:Address1>
> </ns0:User>
> </ns0:Mpi>
> </w:body>
>
> I first need to reference the User node and I am able to achieve it using
> the following line. When this line executes, I do have nodeListTable
> variable referencing the User node.
> XmlNodeList nodeListTable =
> nodeDataset.SelectNodes("//ns0:User",coverLetterSectionTemplateMamespaceManager);
>
> But then I need to reference the Address1 node using the above
> nodeListTable variable. I tried the following line
>
> XmlNodeList nodeListField =
> nodeListTable[0].SelectNodes("//ns0:*",coverLetterSectionTemplateMamespaceManager)
>
> But after this line executes the nodeListField variable contains all nodes
> in the ns0 namespace including Mpi and User nodes. So my question is how
> can I select Address1 node from nodeListTable variable using SelectNodes
> function?
>
> Thanks in advance.
>
>
>
>