|
Posted by Terrence Brannon on September 5, 2005, 4:28 am
Please log in for more thread options
> Consider this HTML::Element dump of a simple HTML page:
>
> <html> @0
> <head> @0.0
> <title> @0.0.0
> "HTML::Element test"
> <body> @0.1
> <div> @0.1.0
> <h1> @0.1.0.0
> "heading"
> <p> @0.1.1
> "paragraph"
>
> I've got to find the <p> after first searching for the <h1>.
you want a sibling of $tree->look_down('_tag' => 'h1') ;
if you use HTML::Element::Library on CPAN you can do this with easeeeee
> Because of the <div> I can't use $h1->right. My first thought was
> to start from
> $h1->pindex in $h1->parent->content_list, but this would fail if there
> were even more levels between the two.
you can always use look_up after looking down :)
> I really need to continue a walk of the tree, starting at h1. I can't
> find an HTML::Element method which does that. It is an easy enough
> iterator to write, but it seems so basic a need that I figure it's there and
> I'm missing it. Is it?
>
> It also seems to me that there should be something like ->look_down
> (->look_next?) which does a search like this, for the same reason.
again HTML::Element::Library contains all of my tree-grokking routines
+ the ones from Matthew Sisk's code for this HTML::Element hax
> >
> --
> Roderick Schertler
> roderick@argon.org
--
Carter's Compass: I know I'm on the right track when,
by deleting something, I'm adding functionality.
|