Ich versuche, eine html doc mit einigen Code zu analysieren ich von dieser aktuellen Seite gefunden aber ich erhalte immer einen Parsing-FehlerEncoding Fehler bei der Verwendung von HTML Agility Pack-
HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument();
// There are various options, set as needed
htmlDoc.OptionFixNestedTags = true;
// filePath is a path to a file containing the html
htmlDoc.Load(@"C:\Documents and Settings\Mine\My Documents\Random.html");
// Use: htmlDoc.LoadXML(xmlString); to load from a string
// ParseErrors is an ArrayList containing any errors from the Load statement
if (htmlDoc.ParseErrors != null && htmlDoc.ParseErrors.Count > 0)
{
// Handle any parse errors as required
MessageBox.Show("Oh no");
}
else
{
if (htmlDoc.DocumentNode != null)
{
HtmlAgilityPack.HtmlNode bodyNode = htmlDoc.DocumentNode.SelectSingleNode("//head");
if (bodyNode != null)
{
MessageBox.Show("Hello");
}
}
}
Jede mögliche Hilfe würde geschätzt:)
Sie haben uns die * genaue Fehlermeldung * nicht mitgeteilt, und Sie haben uns keine Möglichkeit zur Verfügung gestellt, dies zu reproduzieren (d. H. Beispiel HTML). Aber theoretisch sollte so etwas funktionieren ... –