或者说string 能转化为HTMLElement吗?这个string就是一个抓取来的网页的源码。

解决方案 »

  1.   

    楼上是装csharp3.5的吗?帮忙查下HtmlElement有没静态方法Create??
    HtmlElement rootElement = HtmlElement.Create(string);
      

  2.   

    HtmlElement rootElement 表示一个节点,楼主是什么需求?
      

  3.   

    或者说string 能转化为HTMLdocument吧。
    WebBrower 是可以转化为HtmlElement 这个的,一个节点一个节点判断网页的元素,我现在不能通过WebBrower ,所以通过htmlwebresponse吧,但是怎么生成节点,然后判断网页里的元素呢?
      

  4.   


    HtmlDocument document ;
    document.Write(string);可以吗
      

  5.   

      public string HtmlString(string url)
        {
            string html = "";
            WebRequest wr = WebRequest.Create(url);
            StreamReader sr = null;
            WebResponse wres = null;
            try
            {
                wres = wr.GetResponse();
                sr = new StreamReader(wres.GetResponseStream(), Encoding.GetEncoding("gb2312"));
                html = sr.ReadToEnd();
            }
            catch
            {
            }
            finally
            {
                sr.Close();
                wres.Close();
            }
            return html;
        }
      

  6.   

    怎么我问的帮忙在msdn查下HtmlElement有没静态方法Create??这个问题也没人帮我看下,我现在是查不了,