Suppose I've a HTML tree like this:
div
`- ul
`- li (*)
`- li (*)
`- li (*)
`- li (*)
`- ul
`- li
`- li
`- li
How do I select the <li> elements that are marked with (*)? They are direct descendants of the first <ul> element.
Here is how I find the first <ul> element:
my $ul = $div->look_down(_tag => 'ul');
Now I've the $ul, but when I do things like:
my @li_elements = $ul->look_down(_tag => 'li');
It also finds <li> elements that are buried deeper in the HTML tree.
How do I find just the <li> elements that are direct descendants of the first <ul> element? I've an unknown number of them. (I can't just select first 4 as in example).