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

XPath starts-with

Topics: User Forum
Oct 27, 2009 at 6:35 PM

I'm having a bit of trouble using starts-with and I'm not quite sure what I'm doing wrong.

My xPath statment is: div[starts_with(@id,'special_item')]//span[@class='specialspan']/a/@href

When I run myHtmlNode.SelectSingleNode(sPath) the object throws the following:

"Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function."

Can anyone see what I'm doing wrong?

Thanks much!



Nov 14, 2009 at 6:29 PM

I'm not sure if this is the reason, but it is a good place to start looking:

.NET (and by extension, HtmlAgilityPack) only support xPath 1.0, so if any of that is part of xPath 2.0, it will not work in AgilityPack