i tried to use htmlagilitypack to parse a table,after i ve done i realized that i forgot to prove if htmlagility part works or not. ... and its obvious it doesnt work i also didnt know what have i missed and where have i done totally wrong... cause i m a beginner... so pls dont be too hard on me.
public partial class WebForm1 : System.Net.Http.HttpClient
{
protected void Page_Load(object sender, EventArgs e)
{
System.Net.Http.HttpClient httpClient = new System.Net.Http.HttpClient();
string header = "ie";
if (!headers.UserAgent.TryParseAdd(header))
{
throw new Exception("Invalid header value: " + header);
}
header = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)";
if (!headers.UserAgent.TryParseAdd(header))
{
throw new Exception("Invalid header value: " + header);
}
HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument();
htmlDoc.LoadHtml(" http://www.eurogymnasium-waldenburg.de/egw_content/Stunden_Vertretungsplan/home.html");
HtmlNode docNodes = htmlDoc.DocumentNode;
HtmlNode navNode = htmlDoc.GetElementbyId("bereichaktionen");
HtmlNode docNode = htmlDoc.DocumentNode.SelectSingleNode("/html/body[@class='ui-widget']/div[@id='main']/div[@id='vplan']/div[@id='bereichaktionen']");
string nodeValue;
nodeValue = (docNode.InnerText);
Debug.WriteLine("nodeValue");
// i doubt theres somethin wrong above but im not sure whats wrong.
if (htmlDoc.ParseErrors != null && htmlDoc.ParseErrors.Count() > 0)
{
}
else
{
if (htmlDoc.DocumentNode != null)
{
HtmlAgilityPack.HtmlNode bodyNode = htmlDoc.DocumentNode.SelectSingleNode("//body");
if (bodyNode != null)
{
}
}
}
}
the origin url is there ,u guys could have a try
Thank y'all X.L