有HTML DOM呀,可以用来解析HTML。和XML DOM差不多。

解决方案 »

  1.   

    你希望怎样解析?参考:去掉所有HTML标记:string pattern = @"\<[^>]*>";
    Regex regex = new Regex( pattern, RegexOptions.IgnoreCase );
    _HtmlToText = regex.Replace( _HtmlToText, "", -1 );
      

  2.   

    HTML同样符合xml标准.直接解释就行了.
    另,HTML文字内容者在 ">""<"中间.
      

  3.   

    楼上,我给段内容,可否帮我解释一下
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD><TITLE>foxmail 5.0</TITLE>
    <META http-equiv=Content-Type content="text/html; charset=gb2312">
    <META content="MSHTML 6.00.3790.0" name=GENERATOR></HEAD>
    <BODY background=cid:[email protected]>
    <TABLE height="100%" cellSpacing=0 cellPadding=0 width=700 border=0>
      <TBODY>
      <TR>
        <TD vAlign=top width=80>
          <DIV>&nbsp;</DIV></TD>
        <TD vAlign=top>
          <DIV>
          <TABLE height="100%" cellSpacing=0 cellPadding=0 width="90%" border=0>
            <TBODY>
            <TR>
              <TD vAlign=top align=left>
                <DIV>
                <DIV>
                <TABLE height="96%" cellSpacing=0 cellPadding=0 width="96%" 
    border=0>
                  <TBODY>
                  <TR>
                    <TD vAlign=top align=left height=30><FONT face=宋体>
                      <TABLE style="WIDTH: 458px; HEIGHT: 389px" height="100%" 
                      cellSpacing=0 cellPadding=0 width="90%" border=0>
                        <TBODY>
                        <TR>
                          <TD vAlign=top align=left>
                            <DIV><FONT size=2><FONT face=宋体><SPAN 
                            id=_FoxTONAME></SPAN>,</FONT><FONT 
                            face=宋体>你好!</FONT></FONT></DIV>
                            <DIV>&nbsp;</DIV>
                            <DIV><FONT face=宋体 size=2> sgsgd </FONT></DIV>
                            <DIV>&nbsp;</DIV>
                            <DIV><FONT face=宋体 size=2>        致<BR>礼!</FONT></DIV>
                            <DIV>&nbsp;</DIV>
                            <DIV>
                            <DIV><FONT face=宋体>
                            <DIV><FONT size=2><FONT 
                            face=宋体>&nbsp;      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;黄宗成<BR></FONT><FONT 
                            face=宋体>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A 
                            href="mailto:[email protected]">[email protected]</A></FONT></FONT></DIV>
                            <DIV><FONT face=宋体><FONT size=2>          &nbsp;  &nbsp; 
                            &nbsp;2003-11-18</FONT></FONT></DIV><FONT 
                            size=2>              </FONT></FONT></DIV></DIV></TD></TR></TBODY></TABLE></FONT></TD></TR></TBODY></TABLE></DIV></DIV></TD></TR></TBODY></TABLE></DIV></TD></TR>
      <TR>
        <TD vAlign=bottom align=right width=80 height=30>&nbsp;</TD>
        <TD vAlign=bottom align=right height=30><IMG height=209 
          src="cid:[email protected]" width=219></TD></TR></TBODY></TABLE></BODY></HTML>
      

  4.   

    string pattern = @"\<[^>]*>";
    Regex regex = new Regex( pattern, RegexOptions.IgnoreCase );
    _newHtmlToText = regex.Replace( _oldHtmlToText, "", -1 );_oldHtmlToText是你原先的HTML字符串,如"<img src="1.jpg">dddd<a></a>"
      

  5.   

    gOODiDEA(无语) ,按你的方法解析后得到如下内容:foxmail 5.0
      
      
        
          
          xhn_21199,你好!
          &nbsp;
            &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
          &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 9999999999999999999
          &nbsp;
                  致礼!
          &nbsp;
          
          
          &nbsp;      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;黄宗成&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[email protected]
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2003-11-15请问怎么去掉那些&nbsp
      

  6.   

    我只想得到下面内容,请问该怎么办
    xhn_21199,你好!
               9999999999999999999
           致礼!
                                                      黄宗成
                                                       [email protected]
                                                              2003-11-15
      

  7.   

    我也不明白请问  这一句   string pattern = @"\<[^>]*>";  怎么理解是不是表示 < >之间的全部内容?还有  &nbsp; 是什么东西,能去掉?谢谢
      

  8.   

    他想要的是HTML格式正文中实际的文本内容,也就是不包含格式化信息的东西。To 楼主:
    把你现在拿到的东西再作一次HTMLDecode应该就可以了。
      

  9.   

    To Mittermeyer(疾风之狼) 
    请问HTMLDecode怎么用,能否把代码贴出来
      

  10.   

    System.String System.Web.HttpUtility.HtmlDecode(System.String);
      

  11.   

    那些&nbsp;倒是去掉了,但还有那个foxmail 5.0
    该怎么解决啊?  
      
        
          
      

  12.   

    参考以下文章
    使用DHTML DOM组件编译HTML文档 这是比较正统的做法. http://asp.6to23.com/connect/dispbbs.asp?boardid=14&id=17