Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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 http://sourceforge.net/projects/expat/ 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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (1)
As of 2021-10-20 05:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (79 votes). Check out past polls.

    Notices?