I am thinking that this is not the best approach. The XML packages tend to be more for taking structured data and putting it in an XML document (ie databases or values of variables/hashes/arrays) To work with unstructured data, regular expressions seem like the best bet. After loading the text into a variable you do some subsitutes, numbers are easy
$text =~ s/^(|.*\s)(\d+)(\s.*|)$/$1<number>$2<\/number>$3/
# The expression looks like the following
# beginning of line followed by either nothing or at least
# one space which neighbors a set of digits followed by #
# either nothing or at least a space and the end of the line
Deates would be done in a similar approach replacing \d+ with whatever a date looks like. I think there are some loose date modules you might can still some RE's from.
----
I always wanted to be somebody... I guess I should have been more specific.
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.