Re:
The "vcard" divs are children of the "secTitle" divs rather then siblings.
Oh how I wish that were true.
Here is a a snippet of the Husband portion of the page.
<div class="secTitle">HUSBAND</div>
<div style='display:inline' class='vcard' id='hcard-Josiah-Leonard'>
Name:
<span class='fn n'>
<a href="../F247/F247134.htm">
Josiah Leonard
</a>
</span>
<span style='display:none'>
<span class='x-gender'>
Male
</span>
</span>
<a href="#Note1">
Note
</a>
Born:
Married: 2 Nov 1699
<span style='display: none'>
<span class='x-marriage-date'>
1699-11-2
</span>
</span>
at Bridgewater, Plymouth, MA
<span style='display: none'>
<span class='x-marriage-location'>
Bridgewater, Plymouth, MA
</span>
</span>
Died: Abt 1745
<span style='display: none'>
<span class='x-death-date'>
1745-1-1
</span>
</span>
at Bridgewater, Plymouth, MA
<span style='display: none'>
<span class='x-death-location'>
Bridgewater, Plymouth, MA
</span>
</span>
</div>
Other Spouses:
<a href="../F248/F248346.htm">
Abigail Washburn
</a>
<br>
Father:
<a href="../F247/F247134.htm">
John Leonard
</a>
Mother:
<a href="../F247/F247134.htm">
Sarah Leonard
</a>
<br />
I think my problem is that I my iteration with
->right() assumes the
->content array of the parent node contains only references to HTML::Element objects.
This assumption is wrong. The
->content array of an HTML::Element is a mix of text scalars and references. As your code (with the use of if ref() demonstrates).
That this is not the case is demonstrated by this HTML snippet the test page
<span class='BogusClasNameForThisExample'>
Father:
<a href="../F247/F247134.htm">
John Leonard
</a>
Mother:
<a href="../F247/F247134.htm">
Sarah Leonard
</a>
</span>
There are 4 elements in the
->content array of the span node:
- Scalar text: Father
- HTML::Element for <a href="../F247/F247134.htm">
- Scalar text: Mother
- HTML::Element for <a href="../F247/F247134.htm">
I think I need to use the
->objectify_text() and
\->deobjectify_text(). This should pack up the text as HTML::Elements so iterating with the
->right() function should then work.
I will let you know the results when I get home tonight.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.