*
ol**********@gmx.de wrote in microsoft.public.dotnet.xml:
>my XML looks like:
<root xmlns="tempuri.org">
<result xmlns="">
<date>2006-09-14</date>
<status>ok</status>
</result>
</root>
How do I query the status node using .NET 2.0 and XPath?
The only way I found is using local-name():
strState =
xmlDoc.SelectSingleNode("//*[local-name()='status']").InnerText;
Is there another way?
You can setup an XmlNamespaceManager as explained in the MSDN docs, and
generally it would be better to use "/root/result/status" instead of the
more complex expression you are using.
--
Björn Höhrmann · mailto:bj****@hoehrmann.de ·
http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 ·
http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 ·
http://www.websitedev.de/