Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - XPATH question [for use with SelectNodes function in C#] [Thread Next] Re: XPATH question [for use with SelectNodes function in C#]To: NULL Date: 2/4/2005 12:07:00 AM Add your nsmgr to the selectnodes method.
.selectnodes(xpath, nsmgr)
"rapataa" <dg@r...> wrote in message
news:bf294$420230bd$3ed487fc$17150@m......
> 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 | |||
|
