What's the difference?

J

Jeff

I've got an application I'm converting from VB6 to C# 2005. I've
broken my problem down to this (Run on same machine seconds apart):

This works.

Dim dd As New DOMDocument
Dim pNodeList As IXMLDOMNodeList
Dim pNode As IXMLDOMNode

dd.async = False
dd.Load "http://rss.cnn.com/rss/cnn_topstories.rss"

Set pNodeList = dd.selectNodes("//item")
For Each pNode In pNodeList
Next pNode

This doesn't. I get a message that proxy authentication is required (I
didn't need it a second ago):

XmlDocument doc = new XmlDocument();
doc.Load(@"http://rss.cnn.com/rss/cnn_topstories.rss");
XmlNodeList rss = doc.SelectNodes("//item");
foreach (XmlNode r in rss)
{

}

What am I missing?

Thanks
 
G

Guest

See Ben Dewey's reply in the "Efficient way to firing event" topic. I think
he replied to the wrong post.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Subject: Re: Efficient way to firing event..... 12/21/2005 9:30 AM PST

By: Ben Dewey In: microsoft.public.dotnet.languages.csharp


In C# the \ char needs to be repleced with \\ meaning:

XmlNodeList rss = doc.SelectNodes("//item");

needs to be:
XmlNodeList rss = doc.SelectNodes("////item");
or
XmlNodeList rss = doc.SelectNodes(@"//item");
 
H

Hans Kesting

See Ben Dewey's reply in the "Efficient way to firing event" topic. I think
he replied to the wrong post.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Subject: Re: Efficient way to firing event..... 12/21/2005 9:30 AM PST

By: Ben Dewey In: microsoft.public.dotnet.languages.csharp


In C# the \ char needs to be repleced with \\ meaning:

XmlNodeList rss = doc.SelectNodes("//item");

needs to be:
XmlNodeList rss = doc.SelectNodes("////item");
or
XmlNodeList rss = doc.SelectNodes(@"//item");

Correct, a backslash (\) needs to be "escaped", but this is NOT true
for a (forward) slash (/). So "doc.SelectNodes("//item");" is correct.

Hans Kesting
 

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