xpath of SelectNodes() does not work when tag contains xmlns

J

Jazper

hi

i have a problem querying a simple atom-feed by xpath using the
XmlDocument. i'm googleing for hours now and can't get a solution:

--- Code ---
XmlDocument doc = new XmlDocument();
doc.Load(XmlReader.Create(_feed.AbsoluteUri));
XmlNodeList list = doc.SelectNodes("feed");
// list.Count is always 0

--- XML-Document ---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>test</title>
</feed>

now as far as i take out the xmlns="http://www.w3.org/2005/Atom" the
xpath expression just works fine and SelectNodes() returns some
elements. however the atom feed contains this xmlns by default and i
have to deal with it.

what is my fault?
thanks for every hint
jazper manto
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top