Hi all,
Looking to extract all HTML tags from a dump of HTML data and put them all in a listbox.
I currently have the following code.
It displays to me things like HTML HEAD TITLE BODY.
But i want things like the IMG and ALT tags.
' Obtain the document interface
Dim htmlDocument As mshtml.IHTMLDocument2 = DirectCast(New mshtml.HTMLDocument(), mshtml.IHTMLDocument2)
' Construct the document
htmlDocument.write(htmlDocument)
ListBox1.Items.Clear()
' Extract all elements
Dim allElements As mshtml.IHTMLElementCollection = htmlDocument.all
' Iterate all the elements and display tag names
For Each element As mshtml.IHTMLElement In allElements
ListBox1.Items.Add(element.tagName)
Next
' Extract all image elements
Dim imgElements As mshtml.IHTMLElementCollection = htmlDocument.images
' Iterate through each image element
For Each img As mshtml.IHTMLImgElement In imgElements
ListBox2.Items.Add(img.src)
Next
End Sub