HTML::Element->right/->look_down lose, I need to walk the tree
am 20.06.2005 14:56:54 von Roderick SchertlerConsider this HTML::Element dump of a simple HTML page:
@0
"HTML::Element test"
@0.1.0.0
"heading"
@0.1.1
"paragraph"
I've got to find the
after first searching for the
. Because of
the 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.
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.
--
Roderick Schertler
roderick@argon.org
Re: HTML::Element->right/->look_down lose, I need to walk the tree
am 05.09.2005 06:28:53 von Terrence Brannon
Roderick Schertler writes:
> Consider this HTML::Element dump of a simple HTML page:
>
> @0
> @0.0
> @0.0.0
> "HTML::Element test"
> @0.1
> @0.1.0
> @0.1.0.0
> "heading"
>
@0.1.1
> "paragraph"
>
> I've got to find the
after first searching for the
.
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 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.
$h1->pindex in $h1->parent->content_list, but this would fail if there
were even more levels between the two.
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.
--
Roderick Schertler
roderick@argon.org
Re: HTML::Element->right/->look_down lose, I need to walk the tree
am 05.09.2005 06:28:53 von Terrence BrannonRoderick Schertler @0.1.1 after first searching for the
> Consider this HTML::Element dump of a simple HTML page:
>
> @0
> @0.0
>
> "HTML::Element test"
>
>
> @0.1.0.0
> "heading"
>
> "paragraph"
>
> I've got to find the .
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
> 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.