dc_2000
July 2nd, 2007, 04:54 AM
Hi everyone:
I'm trying to isolate all <SCRIPT></SCRIPT> tags inside an HTML document. I can easily find the beginning of the SCRIPT tag (by simply using a text search function on HTML text) but to find its end one needs to parse the contents of the script itself. In light of this, I thought that maybe there's an easier way to find the character offset of all script objects using the MSHTML interfaces?
Here's again what I need in a small example. Say HTML is:
<html><body><script>var v=2;</script></body></html>
I want to get the offset of the script block. In this case it will begin at offset = 12 and will have length of 25 characters.
Now the coding part. I have IHMLDocument2 interface pointer, which I use to get IHTMLElementCollection for all script objects and then look through each of them and get IHTMLElement interface pointer for them. At that point my knowledge of DHTML ends. How can I get the offset of an element in the HTML code? I would appreciate if someone could help me out here :)
Thanks in advance.
I'm trying to isolate all <SCRIPT></SCRIPT> tags inside an HTML document. I can easily find the beginning of the SCRIPT tag (by simply using a text search function on HTML text) but to find its end one needs to parse the contents of the script itself. In light of this, I thought that maybe there's an easier way to find the character offset of all script objects using the MSHTML interfaces?
Here's again what I need in a small example. Say HTML is:
<html><body><script>var v=2;</script></body></html>
I want to get the offset of the script block. In this case it will begin at offset = 12 and will have length of 25 characters.
Now the coding part. I have IHMLDocument2 interface pointer, which I use to get IHTMLElementCollection for all script objects and then look through each of them and get IHTMLElement interface pointer for them. At that point my knowledge of DHTML ends. How can I get the offset of an element in the HTML code? I would appreciate if someone could help me out here :)
Thanks in advance.