Jump to content

_IE line returner?


IAMK
 Share

Recommended Posts

I was wondering if there is any way to know which line or position in the source of a webpage a certain tag is from?

E.g.

Local $spanTags = _IETagNameGetCollection($ie, "span")

For $spanTag In $spanTags
    Consolewrite($spanTag.location & ": " & _IEPropertyGet($spanTag, "InnerText") & @CRLF)
Next

The reason I want this is because I have a mixture of span/div/li tags, which I want to log the information of in the same order as their appearance in the source. My solution to this was to parse through span tags and store them in an array. Repeat for div and li tags. Then, I do a greater/less check on the 3 arrays, giving me 1 final sorted array.

Link to comment
Share on other sites

Maybe something like this (untested)

Local $Tags = _IETagNameAllGetCollection($ie)

For $Tag In $Tags
    $tagname = $Tag.tagname
    If not StringRegExp($tagname, '(?i)span|div|li') Then ContinueLoop
    Consolewrite($tagname & ": " & _IEPropertyGet($Tag, "InnerText") & @CRLF)
Next

as the help file says :
_IETagNameAllGetCollection : Returns a collection object all elements in the document or document hierarchy in source order

Edited by mikell
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...