搜索之路 c#从html中提取文本
直接封装成一个类的,用起来还挺方便的
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text.RegularExpressions;
/// <summary>
/// HtmlExtract 抽取html里面的文本信息
/// </summary>
public class HtmlExtract
{
#region private attributes
private string _strHtml;
#endregion
#region public mehtods
public HtmlExtract(string inStrHtml)
{ _strHtml = inStrHtml;}
public string ExtractText()
{
string result = _strHtml;
result = RemoveComment(result);
result = RemoveScript(result);
result = RemoveStyle(result);
result = RemoveTags(result);
return result.Trim();
}
#endregion
#region private methods
private string RemoveComment(string input)
{
string result = input;
//remove comment
result = Regex.Replace(result, @"<!--[^-]*-->", string.Empty, RegexOptions.IgnoreCase);
return result;
}
相关文档:
首先了解一下什么是Qname
下面是一篇写的比较好的关于Qname的介绍:
http://blog.csdn.net/fbysss/archive/2007/06/24/1664076.aspx
可见Qname主要是处理namesapce的,是指具有特定前缀的xml element。而且Qname就是QualifiedName的缩写,所以Qname在C#中对应的应该是XmlQualifiedName这个类 ......
// 抽象类 package com.albert.email.mime; import org.springframework.mail.javamail.JavaMailSender; public abstract class AbstractMessageSender {
protected String from;
protected String to;
protected String subject; ......
其实就是创建普通文件, CreateFile() 和WriteFile. 然后用ShellExcuteEx()来打开就行了(会自动调用IE).
HANDLE handle;
handle=CreateFile(L"\\windows\\google.html",GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
if(INVALID_HANDLE_VALUE!= handle )
{
DWORD Num;
::WriteF ......
当输入 》时自动补全 当输入《/时自动补全
“=================================
" File: closetag.vim
" Summary: Functions and mappings to close open HTML/XML tags
" Uses: <C-_> -- close matching open tag
" Author: Steven Mueller <di ......
问:
1.如何在JavaScript访问C#函数?
2.如何在JavaScript访问C#变量?
3.如何在C#中访问JavaScript的已有变量?
4.如何在C#中访问JavaScript函数?
问题1答案如下:
javaScript函数中执行C#代码中的函数:
方法一:1、首先建立一个按钮,在后台将调用或处理的内容写入button_click中;
&n ......