private void ParseHtml(HtmlNode node, Parsed parsed) { switch (node.NodeType) { case HtmlNodeType.Document: ParseHtmlContent(node, parsed); break; case HtmlNodeType.Text: string html = ((HtmlTextNode)node).Text; switch (node.ParentNode.Name) { case "script": case "style": // Ignore script and style blocks. return; case "title": // The title is handled special. parsed.Title = HtmlEntity.DeEntitize(html.Trim()); return; } // Is it in fact a special closing node output as text? if (!HtmlNode.IsOverlappedClosingElement(html)) { parsed.Append(HtmlEntity.DeEntitize(html)).Append(' '); } break; case HtmlNodeType.Element: ParseHtmlContent(node, parsed); break; } }
private void ParseHtml(HtmlNode node, Parsed parsed) { switch (node.NodeType) { case HtmlNodeType.Document: ParseHtmlContent(node, parsed); break; case HtmlNodeType.Text: string html = ((HtmlTextNode)node).Text; switch (node.ParentNode.Name) { case "script": case "style": // Ignore script and style blocks. return; case "title": // The title is handled special. parsed.Title = HtmlEntity.DeEntitize(html.Trim()); return; } // Is it in fact a special closing node output as text? if (!HtmlNode.IsOverlappedClosingElement(html)) parsed.Append(HtmlEntity.DeEntitize(html)).Append(' '); break; case HtmlNodeType.Element: ParseHtmlContent(node, parsed); break; } }