Ok, I need to parse webpages (that I wrote, but has been modified by others), and extract pertinent information stored within
<div> </div> tags of class 'listing'. I'll list a sample entry below and then detail what I wish to parse out of it, with the format of another sample. Hopefully this will make sense and I'll gladly accept any advise as to which modules to use to make this easier.
<div class="listing">
Agave parryi
<span style="font-weight: normal;">Parry's agave</span>
<br>$20.00 3 quart
$12.00 Quart
<br><span id="native">Native</span> Sun
to part shade Zones 5-10 Family: <i>Amaryllidaceae</i>
<br>From the Southwest comes this lovely agave. Thick spiny
leaves adorn this hardy agave. Ultimate
clump size is about 36" with each leaf being maybe 5" across. The
flower stalk can reach 12 feet tall. Please plant in well drained soil
in a place
where children don't play. <span id="hummingbird">Hummingbirds</span>
</div>
Ok, what I'd like to get out of this (and there's a lot more html junk around it to ignore) is:
Latin name (ie agave parryi)
Common name (Parry's agave)
Pot price ($20.00)
Pot size (3 quart)
Pot price ($12.00)
Pot size (quart)
Origin: Native
Exposure: Sun to part shade
Hardiness: 5-10
Family: Amaryllidacea
Text description:From the Southwest comes this lovely agave. Thick spiny leaves adorn this hardy agave. Ultimate clump size is about 36" with each leaf being maybe 5" across. The flower stalk can reach 12 feet tall. Please plant in well drained soil in a place
where children don't play.
Special Features: Hummingbirds (there's others of those...but I can handle generalization (I think))
Ok, sorry for such a long post...but I wanted to give a good thorough example.
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.