 <p>Using HtmlAgilityPack (HAP) and XPath function <code>name()</code> didn't work for me, but replacing <code>name()</code> with <code>local-name()</code> did the trick :</p> <pre><code>//*/@*[starts-with(local-name(), 'on')] </code></pre> <p>However, both <code>SelectSingleNode()</code> and <code>SelectNodes()</code> only able to return <code>HtmlNode</code>(s). When the XPath expression selects an attribute instead of node, the attribute's owner node would be returned. So in the end you still need to get the attribute through some options besides XPath, for example :</p> <pre class="lang-cs prettyprint-override"><code>HtmlDocument doc; ...... var link = doc.DocumentNode .SelectSingleNode("//*/@*[starts-with(local-name(), 'on')]"); var onclick = link.Attributes .First(o =&gt; o.Name.StartsWith("on")); </code></pre>