Solved

Using the MSHTML collection with a string containing HTML

Posted on 2006-06-17
5
302 Views
Last Modified: 2008-01-09
I'm request html using the following method,


      Dim sResult As String
                        Dim oHttp As HttpWebRequest
                        Dim objResponse As WebResponse
                        Dim objRequest As WebRequest = System.Net.HttpWebRequest.Create(EventUrl)




                        objRequest.Method = "GET"
                        objRequest.Timeout = 120000 ' 20 sec.
                        objResponse = objRequest.GetResponse

                        Dim sr As System.IO.StreamReader = New System.IO.StreamReader(objResponse.GetResponseStream(), System.Text.Encoding.UTF7)

                        sResult = sr.ReadToEnd()
                        ' Close and clean up the StreamReader
                        sr.Close()

debug.write(sresult.tostring)

                        Dim DOCHTML As String
                        doc = DirectCast(sResult, mshtml.HTMLDocument)
                        dochtml = doc.documentElement.innerHTML()
                        Debug.Write(DOCHTML)


This doesn't seem to convert the html string so that it can be used with the mshtml collection. If I choose to display the html after it finishes with debug.write(sresult.tostring) it will output to the debug window. But when I try to output it with  Debug.Write(DOCHTML) it won't work. 500 points because I'm trying to finish the development of this application within the next few weeks. thanks guys.


0
Comment
Question by:JPERKS1985
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 16934761
Here is a class that I use, instead of an HttpWebRequest to parse an HTML document:

http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21767542.html

Bob
0
 
LVL 1

Author Comment

by:JPERKS1985
ID: 16938639
Hmm problem is I need to parse out different controls , heres part of the code I'm using









        For Each elm In all
            strName = elm.getAttribute("NAME")
            strId = elm.id
            strvalue = elm.innerText
            strType = elm.getAttribute("type")


Anyway to convert my string to wokr with that?
0
 
LVL 1

Author Comment

by:JPERKS1985
ID: 16939792
nevermind I got it working thanks.
0
 
LVL 1

Author Comment

by:JPERKS1985
ID: 16939961
Now is there a way to use this source to pass cookies? Also is there a way for proxy support? Thats why I was using httprequest
0
 
LVL 1

Author Comment

by:JPERKS1985
ID: 16940101
Better yet, how do I extract the cookies and route the request for the page through a proxy?
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question