0
votes

I'm trying to get all the nodes in a webpage. I've re-checked the XPATH string a lot of times but still no result: I have tried using the following code:

    string publicatiom = "WO2007000010";
    string Check_URL = @"http://patentscope.wipo.int/search/en/detail.jsf?docId=" publication + "&tab=PCTDocuments";
    var baseUrl = new Uri(Check_URL);
    HtmlWeb hw = new HtmlWeb();
    HtmlAgilityPack.HtmlDocument doc = hw.Load(baseUrl.ToString());
    string checkstring = "*//[@id='detailMainForm:j_idt1375:0:j_idt1394']";
    HtmlNodeCollection Nodes = doc.DocumentNode.SelectNodes(checkstring);

However, it returns a runtime error.

1
What are you trying to select, a div or what? You need to add that after *// - Kuzgun
I understand that the * is a wildcard for all kinds. Anyway I want a 'td'. - argledhel
Did you try //*[@id='detailMainForm:j_idt1375:0:j_idt1394'] ? - Kuzgun
It worked! Thanks for the hint! - argledhel

1 Answers

0
votes

string checkstring = "//*[@id='detailMainForm:j_idt1375:0:j_idt1394']";

the XPath should start //* rather than *//