This project has moved and is read-only. For the latest updates, please go here.

Can't seem to remove nodes

Topics: User Forum
Apr 30, 2016 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.

HtmlAgilityPack.HtmlNode tipGif = 
                    doc.DocumentNode.SelectSingleNode("//img[@src = '']");

                if (tipGif != null)
                    var nodesToRemove = doc.DocumentNode
                    .SelectNodes("//img[@src = '']")

                    foreach (var node in nodesToRemove)
var RL = doc.DocumentNode.SelectSingleNode("//img[@src = '']");
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.