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 |