Update: This is all wrong. :-( I misread the HTML.

See my second attempt.

This might help illustrate "siblings".

#!/usr/bin/perl use warnings; use strict; use lib q{/www/lib}; use SW::Debug; use HTML::TreeBuilder; my $content = do{local $/;<DATA>}; my $t = HTML::TreeBuilder->new_from_content($content) or die qq{cant build tree}; my $body = $t->look_down(_tag => q{body}); my $p = $t->look_down(_tag => q{p}); my @right = $p->right; print scalar @right, qq{ siblings\n}; for my $ele (@right){ $ele->dump; print q{-} x 20, qq{\n}; } __DATA__ <p id = "1">one</p> <p id = "2">two</p> <p id = "3">three</p>
2 siblings <p id="2"> @0.1.1 "two" ---------- <p id="3"> @0.1.2 "three" ----------
Which I don't think is what you're after. In the
foreach my $Node (@PageSections)
loop you want to look down for divs with class = "vcard" and then look down into each of those to get the data you need.

The "vcard" divs are children of the "secTitle" divs rather then siblings.

HTH


In reply to Re: Traversing an HTMLTree with HTML:Element ->right by wfsp
in thread Traversing an HTMLTree with HTML:Element ->right by johnwashburn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.