Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

You should really use an XML parser (what else would you expect from me ;--). On top of the reasons given in On XML Parsing, if the format of the CB changes even slightly you will have to update your code (think about an extra attribute for each message). If you used an XML module you would have a much better chance to survive those modifications. Plus learning how to use one of the XML modules is a Good Thing (tm).

2 more points: I don't find XML::Simple difficult to install. I would not use the xml bundle. Either get XML::Parser 2.27 which comes with expat or get XML::Parser 2.30 and expat from and compile it, install XML::Parser get XML::Simple, install it et voila!

Then I am not sure I would want to use XML::Simple for the CB. The problem is that it will create an unordered list of messages, that you then have to order on the time field. I would probably use XML::PYX to get the messages in the right order. OK, I'm lying I would use XML::Twig, but maybe starting with PYX would be easier.

Update: epoptai below is right, XML::Simple actually stores the messages in the proper order. I would have sworn I saw them messed up the other day. I would still try another method, if only to get a break from the ubiquitous XML::Simple ;--)

Here is how XML::PYX outputs each message in the CB:

(message Aauthor strredwolf Atime 20010228082806 -\n -OK, I'm convinced, I will use XML::PYX )message

Easy to process isn't it?

In reply to Re: RedWolf MonkChatter by mirod
in thread RedWolf MonkChatter by strredwolf

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others examining the Monastery: (2)
    As of 2021-04-18 18:26 GMT
    Find Nodes?
      Voting Booth?

      No recent polls found