Given the following...
HtmlNode myDiv = doc.DocumentNode.SelectSingleNode("//div[@id='someid']");
...where the resulting myDiv.InnerHtml contains:
<span>...other content I want to consume...</span>
<a href="http://www.somewhere.com" onmousedown="return somefunc('random','parm','values','SHXA213')">Click Me</a>
<span>...and more content I want to consume...</span>
Is there a way to not select the onmousedown portion of the anchor tag?
Solution
What I needed to do was the following:
HtmlNodeCollection anchors = myDiv.SelectNodes(@"//a[@class='someclass']");
anchors[0].SetAttributeValue("onmousedown", "");
// could have also used anchors[0].Attributes.Remove() or .RemoveAt()