Hey Now, just a little question. Ok I understand regular expressions and all but what I am looking to do is to parse HTML.
Sounds simple enough. Heres and example of what I want to do:
Say there is a static webpage with some HTML that looks like this
<p><b>Location:</b>
Northern Africa, bordering the Mediterranean Sea, between Egypt and Tu
+nisia
<p><b>Geographic coordinates:</b>
25 00 N, 17 00 E
<p><b>Map references:</b>
Africa
<p><b>Area:</b>
<br><i>total:</i>
1,759,540 sq km
<br><i>land:</i>
1,759,540 sq km
<br><i>water:</i>
0 sq km
<p><b>Area - comparative:</b>
slightly larger than Alaska
<p><b>Land boundaries:</b>
<br><i>total:</i>
4,383 km
<br><i>border countries:</i>
Algeria 982 km, Chad 1,055 km, Egypt 1,150 km, Niger 354 km, Sudan 383
+ km, Tunisia 459 km
<p><b>Coastline:</b>
1,770 km
how would I parse this to enter into a database so that under Location would go the appropiate data and so on. And also how would you best recive the HTML, say from http://www.foobar.com/poopy/data.html
how would I best get the HTML and then parse it into a database. Thank you if you can help out at all
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.