Solved

Using the MSHTML collection with a string containing HTML

Posted on 2006-06-17
5
301 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
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
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…

860 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