Can't seem to remove nodes

Topics: User Forum
Apr 30 at 12:49 AM
Embarrasingly trivial problem, but I've only ever used HAP for scraping websites and never tried to manipulate the html.

I'm trying to remove an img node and neither of the approaches listed below seem to work.

(A)
HtmlAgilityPack.HtmlNode tipGif = 
                    doc.DocumentNode.SelectSingleNode("//img[@src = 'http://www.stuff.com/ico/annoying-gif.gif']");

                if (tipGif != null)
                {
                    var nodesToRemove = doc.DocumentNode
                    .SelectNodes("//img[@src = 'http://www.stuff.com/ico/annoying-gif.gif']")
                   .ToList();

                    foreach (var node in nodesToRemove)
                       node.Remove();
            }
(B)
var RL = doc.DocumentNode.SelectSingleNode("//img[@src = '
http://www.stuff.com/ico/annoying-gif.gif']");
RL.Remove();
I think I'm missing something fundamental about how this method works. I can post an example of the html but it's very vanilla.

Thanks in advance.