Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries [Thread Prev] >Thread Next - Re: XPATH question [for use with SelectNodes function in C#] XPATH question [for use with SelectNodes function in C#]To: NULL Date: 2/3/2005 3:10:00 PM hi,
I'm trying to extract the nodes that use a specific prefix from the
following XML:
<xmldoc>
<ww:somenode1 />
<ww:somenode2 />
<ww:somenode3 />
<node>
<ww:somenode6 />
</node>
<node>
<ww:somenode6 />
<ww:somenode12 />
</node>
</xmldoc>
As you van see, the "ww:" nodes are used on different levels in the
document.
I'm using the following C# code:
xDOC.Load(strXMLdoc);
XmlNamespaceManager nsmgr = new XmlNamespaceManager(xDOC.NameTable);
nsmgr.AddNamespace("ww", "http://whatever");
XmlNodeList NL = sDOC.DocumentElement.SelectNodes("//ww:@*");
... but this doesn't result in a nodelist with only "ww"-elements ...
thanks!
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
