467,077 Members | 1,067 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,077 developers. It's quick & easy.

Help parsing text using MsHTM.dll...

Using VB.NET under .NET 1.1 in VS2003,

BACKGROUND
I have a windows application that dereferences the MsHTM.dll. The app
is successfully able to parse existing HTM documents allowing me to
access the DOM objects as needed.
With my latest changes I want to utilize the MsHTM.dll to parse some
text for me. For instance, I'd like to be able to parse the following
text into an element, and then inspect its child nodes later on...
1 Dim objGeneric As HTMLGenericElement =
browser.Document.createElement("span")
2 objGeneric.innerHTML = "<!-- some string on HTML code --><span
style='color:#FF0000;'>some span text</span>"
3 For Each objNode As HTMLGenericElement In objGeneric.childNodes
4 'Do something here...
5 Next
PROBLEM
After executing line 2 above, the innerHTML contains the only the span
tags its attributes and enclosed text node - the comment element has
disappeared. This is true if I use a HTMLDivElement also. My problem
is that I need to capture and parse the text in the comment... is this
possible?

Instead of reading the string on line 2 into a span or div object, I
also tried creating a comment object - but then I'm stuck with a
comment within a comment and I'm forced to-do Instr(Ö) parsing which
is what I was trying to avoid in the first place.

Anyone have any idea how to capture the elements, both comment and
otherwise, using the MsHTM.dll?

Your feedback appreciated.
celoftis
Jun 27 '08 #1
  • viewed: 820
Share:

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by wukexin | last post: by
4 posts views Thread by ralphNOSPAM@primemail.com | last post: by
3 posts views Thread by Pir8 | last post: by
reply views Thread by Juky | last post: by
reply views Thread by bharathitm@gmail.com | last post: by
13 posts views Thread by Chris Carlen | last post: by
2 posts views Thread by embz | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.