in reply to Perl has plenty of XML parsers, but is there an XML printer?

I'm not sure why you want to "print" the log file. I'm assuming for the sake of this post that you just need some human-readable way of viewing the XML log. So with that in mind I'm thinking that you may not even need a Perl module. Why don't you just create an XSLT style sheet for use with a browser and have each log file reference that stylesheet.

I have done this before for server status reports. The XML document makes a nice, machine-readable status report. Feeding the exact same document to a browser such as Firefox gives HTML (or text) output for humans, since it references the XSLT stylesheet.

Again, I'm not sure what you're after, but I thought I'd mention this approach.

  • Comment on Re: Perl has plenty of XML parsers, but is there an XML printer?

Replies are listed 'Best First'.
Re^2: Perl has plenty of XML parsers, but is there an XML printer?
by yaneurabeya (Novice) on Jul 19, 2007 at 23:24 UTC

    This isn't going to be used in a web environment, so I don't think that there will be a need for a solution like a XSLT stylesheet.

    All that's going to be done is data retrieval and comparison via flat files (don't have access to a DB).

      Getting access to a db like SQLite or MySQL or PostgreSQL isn't that hard. But if you really want to compare flat files and XML files in a database-like manner without a database, then DBD::AnyData sounds like what you want. It handles many kinds of flat files (CSV, Fixed-width, ini, etc.) and uses XML::Twig to both read and write XML files using the standard DBI interface.

        I completely forgot about SQLite, and it's in my work's Perl dist!

        Nevermind XML, I'm going to use that :)..

      For a quick and easy database take a look at DBD::SQLite and DBI - that's the whole ball o' wax.


      DWIM is Perl's answer to Gödel