private static HtmlNodeCollection removeTextNodes (HtmlNodeCollection collection)
 {
     for (int i = 0; i < collection.Count; i++)
     {
         if (collection[i].Name == "#text")
         {
             collection.RemoveAt(i);
             //Not in final!!!
             i--;
             continue;
         }
     }
     return collection;
 }
Пример #2
0
 /// <summary>
 /// 取得比分
 /// </summary>
 /// <param name="tdColl">比分資料節點集合</param>
 /// <param name="scoreboard">賽事比分</param>
 /// <param name="R">R分</param>
 /// <param name="H">H分</param>
 /// <param name="E">E分</param>
 private void GetTeamScoreTSLC(HtmlNodeCollection tdColl, List<string> scoreboard, out string R, out string H, out string E)
 {
     R = String.Empty;
     H = String.Empty;
     E = String.Empty;
     //去掉没用的
     tdColl.RemoveAt(0);
     foreach (HtmlNode td in tdColl)
     {
         if (string.IsNullOrWhiteSpace(td.InnerText.Trim()))
         {
             continue;
         }
         scoreboard.Add(td.InnerText.Trim());
     }
     if (scoreboard.Count > 0)
     {
         E = scoreboard[scoreboard.Count - 1];
         scoreboard.RemoveAt(scoreboard.Count - 1);
         H = scoreboard[scoreboard.Count - 1];
         scoreboard.RemoveAt(scoreboard.Count - 1);
         R = scoreboard[scoreboard.Count - 1];
         scoreboard.RemoveAt(scoreboard.Count - 1);
     }
 }
 private HtmlNodeCollection RemoveTextAttributes (HtmlNodeCollection collection)
 {
     for (int i = 0; i < collection.Count; i++)
     {
         if (collection[i].Name == "#text")
         {
             collection.RemoveAt(i);
             i--;
         }
     }
     return collection;
 }
Пример #4
0
 private void GetTeamScore(HtmlNodeCollection tdColl, List<string> scoreboard, out string R, out string H, out string E)
 {
     R = H = E = string.Empty;
     if (tdColl == null) return;
     //去掉没用的
     tdColl.RemoveAt(0);
     foreach (HtmlNode td in tdColl)
     {
         if (string.IsNullOrWhiteSpace(td.InnerText.Trim()) || td.InnerText.Trim() == "-" || td.InnerText.Trim() == "&nbsp;")
         {
             continue;
         }
         scoreboard.Add(td.InnerText.Replace("&nbsp;", "").Trim());
     }
     if (scoreboard.Count > 0)
     {
         E = scoreboard[scoreboard.Count - 1];
         scoreboard.RemoveAt(scoreboard.Count - 1);
         H = scoreboard[scoreboard.Count - 1];
         scoreboard.RemoveAt(scoreboard.Count - 1);
         R = scoreboard[scoreboard.Count - 1];
         scoreboard.RemoveAt(scoreboard.Count - 1);
     }
 }