ËÑË÷֮· 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Õâ¸öÀà ......
ÍøÕ¾ÓÅ»¯
³£ÓõÄHTML±êÇ©:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<body>
<h1>H1±êÇ©£¬¶¨ÒåÎÄÕ±êÌ⣬һ¸öÒ³ÃæÖ»ÒªÒ»¸ö</h1>
<h2>H2±êÇ©£¬¶¨ÒåÎÄÕ±êÌ⣬һ¸öÒ³ÃæÖ»ÒªÒ ......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; char ......
µÚÒ»ÖÖ£º
<script language="javascript" type="text/javascript">
window.location.href="login.jsp?backurl="+window.location.href;
</script>
µÚ¶þÖÖ£º
<script language="javascript">
alert("·µ»Ø");
window.history.back ......
flexǶÈëµ½html£º
ÓÃswfobject,ÏÂÔØµÄ.jsµØÖ·£ºhttp://www.adobe.com/devnet/activecontent/articles/devletter.html
ÔÚÄãµÄ HTML Ò³ÃæÍ·²¿<head>ÇøÇ¶ÈëÕâ¸ö½Å±¾Îļþ£º<script type="text/javascript" src="swfobject.js"></script>
ÔÚÄãµÄ HTML ÖÐдһ¸öÓÃÀ´·Å Flash µÄÈÝÆ÷£¬±ÈÈç<div> ......