HtmlAgilityPack example for changing links doesn't work. How do I accomplish this?
The example on codeplex is this : HtmlDocument doc = new HtmlDocument(); doc.Load("file.htm"); foreach(HtmlNode link in doc.DocumentElement.SelectNodes("//a[@href"]) { HtmlAttribute att = link["href"]; att.Value = FixLink(att); } doc.Save("file.htm"); The first issue is HtmlDocument. DocumentElement does not exist! What does exist is HtmlDocument. DocumentNode but even when I use that instead, I'm unable to access the href attribute as described. I get the following error: Cannot apply indexing with [] to an expression of type 'HtmlAgilityPack.HtmlNode' Here's the code I'm trying to compile