title: Html agility pack/ xpath select child node by [index] help, please?
body: <p>I've been working for a while with a node set in C#/ html agility pack, and through trial and error I have a a list of nodes that I want to loop over, getting the child nodes of each of the nodes from the loop. I'd like to refer to them by index # (seems to be the easiest, yet here I post). I've tried different ways to format the xpath, including "[0]", "/[0]", "tr/[0]", etc. Here's what I have so far, everything working fine up to the first commented line:</p>
  
  <pre><code>protected override List&lt;IDataPoint&gt; ReturnDataPointsFromIndividualAddressString(string AddressString)
              {
                  List&lt;IDataPoint&gt; earningsAnnouncements = new List&lt;IDataPoint&gt;();
  
                  HtmlWeb hwObject = new HtmlWeb();
                  HtmlDocument htmlDoc = hwObject.Load(AddressString);
  
                  if (htmlDoc.DocumentNode != null)
                  {
                      List&lt;HtmlNode&gt; nodeList = new List&lt;HtmlNode&gt;();
  
                      var nodes = htmlDoc.DocumentNode.SelectNodes("html[1]/body[1]/table[4]/tr[1]/td[1]/table[1]/tr");
  
                      if (nodes != null)
                      {
                          foreach (HtmlNode n in nodes)
                          {
                              if (n.OuterHtml.Contains("finance.yahoo.com"))
                                      nodeList.Add(n);
                          }
                      }
  
                      foreach (HtmlNode node in nodeList)
                      {
                          EarningsAnnouncementDP earningsAnnouncement = new EarningsAnnouncementDP();
  
                          //Error: Expression must evaluate to a node set.
                          earningsAnnouncement.Company = (node.SelectSingleNode("[0]")).InnerText.ToString();
                          earningsAnnouncement.Ticker = node.SelectSingleNode("[1]").InnerText.ToString();
                          earningsAnnouncement.Estimate = node.SelectSingleNode("[2]").InnerText.ToString();
                          earningsAnnouncement.AnnouncementTime = node.SelectSingleNode("[3]").InnerText.ToString();
  
                          earningsAnnouncements.Add(earningsAnnouncement);
                      }
  
                      return earningsAnnouncements;
                  }
  </code></pre>