HtmlAgility: nenhum conteúdo apareceu (C #, UWP)
Eu tentei usar o htmlagilitypack para analisar uma tabela, depois que concluí percebi que esqueci de provar se a parte do htmlagility funciona ou não. ... e é óbvio que ele não funciona, eu também não sabia o que eu perdi e onde eu fiz totalmente errado ... porque eu sou iniciante ... então os pls não são muito duros comigo.
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");
// duvido que algo esteja errado acima, mas não tenho certeza do que está errado.
if (htmlDoc.ParseErrors != null && htmlDoc.ParseErrors.Count() > 0)
{
}
else
{
if (htmlDoc.DocumentNode != null)
{
HtmlAgilityPack.HtmlNode bodyNode = htmlDoc.DocumentNode.SelectSingleNode("//body");
if (bodyNode != null)
{
}
}
}
}
o URL de origem está aí, vocês poderiam tentar
Obrigado X.L