Htmlagilitypack 不转换 <i> 标签
Htmlagilitypack do not convert <i> tag
我不转换为 HTMLAgilityPack 标签。我怎样才能使转换的值?
这样我想得到一个输出
Yayın Tarihi:13.09.2015 --Güncelleme Tarihi:18.09.2015
<ul class="DefaultAspxWebParcasi">
<li>
<a href="http://www.e-saglik.gov.tr/belge/1-44068/ozel-saglik-kurum-ve-kuruluslari-tarafindan-saglik-net-.html">
<i> -Yayın Tarihi</i>
: 18.09.2015 /
<i> Güncellenme Tarihi</i>
: 18.09.2015
</li>
<li>
<a href="http://www.e-saglik.gov.tr/belge/1-42578/sagliknet-sistemi-2-ve-3-basamak-veri-gonderimi-ile-ilg-.html">
<i> -Yayın Tarihi</i>
: 13.08.2015 /
<i> Güncellenme Tarihi</i>
: 18.09.2015
</li>
C#代码在这里。
WebClient wc = new WebClient();
wc.Encoding = Encoding.UTF8;
string data = wc.DownloadString(Link());
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(data);
HtmlAgilityPack.HtmlNodeCollection icCont2 = doc.DocumentNode.SelectNodes(@"//ul[@class='DefaultAspxWebParcasi']//li//a");
foreach (HtmlAgilityPack.HtmlNode item in icCont2)
{
string iler = item.SelectSingleNode("//i").InnerHtml.ToString();
Console.WriteLine(iler);
}
以下代码将生成 -Yayın Tarihi : 18.09.2015 / Güncellenme Tarihi : 18.09.2015。希望这会有所帮助
var doc = new HtmlDocument();
doc.LoadHtml(data);
HtmlAgilityPack.HtmlNodeCollection icCont2 = doc.DocumentNode.SelectNodes(@"//ul[@class='DefaultAspxWebParcasi']//li//a");
foreach (HtmlAgilityPack.HtmlNode item in icCont2)
{
Regex trimmer = new Regex(@"\s\s+");
var iler = trimmer.Replace(item.InnerText, " ");
Console.WriteLine(iler);
}
我不转换为 HTMLAgilityPack 标签。我怎样才能使转换的值?
这样我想得到一个输出
Yayın Tarihi:13.09.2015 --Güncelleme Tarihi:18.09.2015
<ul class="DefaultAspxWebParcasi">
<li>
<a href="http://www.e-saglik.gov.tr/belge/1-44068/ozel-saglik-kurum-ve-kuruluslari-tarafindan-saglik-net-.html">
<i> -Yayın Tarihi</i>
: 18.09.2015 /
<i> Güncellenme Tarihi</i>
: 18.09.2015
</li>
<li>
<a href="http://www.e-saglik.gov.tr/belge/1-42578/sagliknet-sistemi-2-ve-3-basamak-veri-gonderimi-ile-ilg-.html">
<i> -Yayın Tarihi</i>
: 13.08.2015 /
<i> Güncellenme Tarihi</i>
: 18.09.2015
</li>
C#代码在这里。
WebClient wc = new WebClient();
wc.Encoding = Encoding.UTF8;
string data = wc.DownloadString(Link());
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(data);
HtmlAgilityPack.HtmlNodeCollection icCont2 = doc.DocumentNode.SelectNodes(@"//ul[@class='DefaultAspxWebParcasi']//li//a");
foreach (HtmlAgilityPack.HtmlNode item in icCont2)
{
string iler = item.SelectSingleNode("//i").InnerHtml.ToString();
Console.WriteLine(iler);
}
以下代码将生成 -Yayın Tarihi : 18.09.2015 / Güncellenme Tarihi : 18.09.2015。希望这会有所帮助
var doc = new HtmlDocument();
doc.LoadHtml(data);
HtmlAgilityPack.HtmlNodeCollection icCont2 = doc.DocumentNode.SelectNodes(@"//ul[@class='DefaultAspxWebParcasi']//li//a");
foreach (HtmlAgilityPack.HtmlNode item in icCont2)
{
Regex trimmer = new Regex(@"\s\s+");
var iler = trimmer.Replace(item.InnerText, " ");
Console.WriteLine(iler);
}