Mi piacerebbe analizzare la pagina html usando C #. Ci sono pagine html che contengono molti tag html, ecco un esempio di uno di questi:
<span class=text14 id="article_content"><!-- RELEVANTI_ARTICLE_START --><span ></b>The
most important component for <a
class=bluelink href="http://www.ynetnews.com/articles/0,7340,L-
3284752,00.html%20"' onmouseover='this.href=unescape(this.href)'
target=_blank>Israel</a>'s
security is its special relations with the American administration, and especially with its generous purse. When the Netanyahu government launches a great outcry against the <a ...
ma mi piacerebbe solo ottenere il contenuto avvolto dal <span class=text14 id="article_content">
. All'inizio ho pensato di usare preg match, ma poi ho capito che non è affatto efficiente. Ho letto in seguito su Html Agility Pack e FizzlerEx - mi piacerebbe sapere se è possibile ottenere il testo avvolto dal tag specifico che ho menzionato utilizzando questi strumenti, e sarei grato se qualcuno potesse dirmi come veloce questa attività potrebbe essere eseguita.
È abbastanza semplice usare Html Agility Pack :
var markup = @"<span class=text14 id=""article_content""><!-- RELEVANTI_ARTICLE_START --><span ></b>The most important component for <a class=bluelink href=""http://www.ynetnews.com/articles/0,7340,L-3284752,00.html%20""' onmouseover='this.href=unescape(this.href)' target=_blank>Israel</a>'s security is its special relations with the American administration, and especially with its generous purse. When the Netanyahu government launches a great outcry against the</span>";
var doc = new HtmlDocument();
doc.LoadHtml(markup);
var content = doc.GetElementbyId("article_content").InnerText;
Console.WriteLine(content);