Quantcast
Channel: htmlagilitypack Forum Rss Feed
Viewing all articles
Browse latest Browse all 655

New Post: Issue with xpath

$
0
0
Does Httpagility pack support indexes in xpath expression. I have an xpath like following to get to a specific node.

string nodexpath = "/html/body/table/tr[0]/td[0]";

It is erroring out with System.NullReferenceException, in the last line

Here's the code

string nodexpath = "/html/body/table/tr[0]/td[0]";
        HtmlDocument htmldoc = new HtmlDocument();

        htmldoc.Load(@"C:\visual studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\bin\Debug\test.aspx");

        Console.WriteLine(htmldoc.DocumentNode.SelectSingleNode(nodexpath).InnerHtml);

Also tried this below to no avail.

string nodexpath = "/html/body/table/tr[position=0]/tdposition[0]";

Viewing all articles
Browse latest Browse all 655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>