|
-
Apr 21st, 2003, 12:09 PM
#1
Thread Starter
Addicted Member
is there an HTML Reader object? **resolved**
I'm looking for an object that will let me supply it with some HTML code (submitted by the user) and return a collection of objects like the HTML DOM. I'm trying not to do this with a reg ex, but If I must, I will.
For example:
A user submits some HTML. It has some links in it. I want to be able to readjust those links as if by saying
VB Code:
'Total psuedocode
'Take no stock in poor syntax
Dim objDoc As New HTMLDocumentReader 'I wish
Dim colA As [i]Elements[/i]
colA = objDoc.document.getElementsByTagName("a")
For i = 0 To colA.length - 1
colA(i).href= "MyHREF"
Next
Last edited by WALDO; Apr 21st, 2003 at 04:05 PM.
-
Apr 21st, 2003, 03:30 PM
#2
PowerPoster
I haven't found one with .net yet (that doesn't mean it doesn't exist though). I settled on using the old COM parser for the things you are trying to do.
-
Apr 21st, 2003, 03:42 PM
#3
Thread Starter
Addicted Member
Yo, I got it
It kinda sux, but this is how I got it to run:
I had to create 2 COM references. (Damn interop)
MSHTML.dll
SHDocVw.dll
VB Code:
Dim htmlDOM As IHTMLDocument2
Dim brwTest As New SHDocVw.InternetExplorer() 'WebBrowser()
brwTest.Navigate("about:blank")
htmlDOM = brwTest.Document
'Load some user submitted source
htmlDOM.body.innerHTML = Request.Form("HTMLSource")
'Play with some elements
Dim objI As IHTMLElement
For Each objI In htmlDOM.images
objI.src = "/KnowledgeBase/Support/4/test.gif"
Next
Me.TextBox1.Text = htmlDOM.body.innerHTML
htmlDOM = Nothing
brwTest.Dispose()
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|