wbushey has asked for the wisdom of the Perl Monks concerning the following question:
Hello Esteemed Monks of Perl,
I have a problem that I have been working on for a couple of days. I'm a new comer to Perl, so I may be missing something obvious, but my searching through the web and documentation has not produced a definitive answer on this.
My problem is I have some string of text ($text) that I know is somewhere in a page of HTML. What I would like to do is search though the HTML for $text and find out what the lowest level element is that contains $text, and be able to find out the ancestors for that element.
I feel like I am in the right arena with HTML::TreeBuilder and HTML::TokeParser, since TreeBuilder maintains the relationships I am looking for while TokeParser make it easy to search for text, but I feel like I need some combination of the two. I also feel like I might be overlooking something obvious in one or the other (I guess I have a lot of feelings.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Finding the DOM element via text search
by jrsimmon (Hermit) on Jul 02, 2009 at 14:47 UTC | |
|
Re: Finding the DOM element via text search
by Anonymous Monk on Jul 02, 2009 at 14:45 UTC | |
|
Re: Finding the DOM element via text search
by wfsp (Abbot) on Jul 03, 2009 at 10:36 UTC |