htmlタグ及びxpath処理に関する方法
htmlタグ及びxpath処理に関する方法
ダイレクトコード
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using HtmlAgilityPack;
namespace TL.NewsGatheringService.Business.Implement
{
///
///
///
public class StrHelperUtil
{
///
/// HTML
///
///
///
public static string FormatHtml(string strHtml)
{
//
strHtml = Regex.Replace(strHtml, @"]*?>.*? ", "", RegexOptions.IgnoreCase);
// HTML
strHtml = Regex.Replace(strHtml, @"]*)>", "", RegexOptions.IgnoreCase);
strHtml = Regex.Replace(strHtml, @"([rn])[s]+", "", RegexOptions.IgnoreCase);
strHtml = Regex.Replace(strHtml, @"-->", "", RegexOptions.IgnoreCase);
strHtml = Regex.Replace(strHtml, @"
があるかもしれません
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using HtmlAgilityPack;
namespace TL.NewsGatheringService.Business.Implement
{
///
///
///
public class StrHelperUtil
{
///
/// HTML
///
///
///
public static string FormatHtml(string strHtml)
{
//
strHtml = Regex.Replace(strHtml, @"]*?>.*? ", "", RegexOptions.IgnoreCase);
// HTML
strHtml = Regex.Replace(strHtml, @"]*)>", "", RegexOptions.IgnoreCase);
strHtml = Regex.Replace(strHtml, @"([rn])[s]+", "", RegexOptions.IgnoreCase);
strHtml = Regex.Replace(strHtml, @"-->", "", RegexOptions.IgnoreCase);
strHtml = Regex.Replace(strHtml, @"