Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Comment on

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

In most cases, XML is overly verbose. CSV is more compact, more humanly readable, has a greater 1-to-1 correspondence to rows of data in your database, and is a more 'native format' for a spreadsheet (rows/columns of the CSV correspond to rows/columns of the spreadsheet).

XML has it's place, but IMO it's been greatly misused/abused. Say, for example, that you needed to generate a very complex report. Generating the data for the report was going to require multiple complex, multi-table joins on tables having millions of rows each (not the kind of thing you want to have to do very frequently). Let's also suppose that you want to generate your report in several formats: maybe HTML, for a web page; CSV for a spreadsheet; RTF for a MS-WORD document; and maybe PDF, just for grins and giggles. In a scenario like that, it might make sense to hit the database ONCE, store the results in XML, since it makes a good INTERMEDIATE format, and then run a series of converters in parallel (i.e., xml-to-html, xml-to-csv, xml-to-rtf, and xml-to-pdf).

Too many times I've seen people using XML as a kind of flat-file, text-based, database language. That's not what it was designed for, and it's not particularly good at it.

If you only have one target output (not many) and you can more easily generate that output (i.e., CSV), there's no need to go through the extra effort of generating XML as an intermediate format. Read the docs on cpan for Parse::CSV and compare to XML::Parser and think about if you really need to use XML or not.


In reply to Re^3: XML and Databases and Excel, Oh My! by scorpio17
in thread XML and Databases and Excel, Oh My! by jedikaiti

Title:
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!
  • 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
  • Outside of code tags, you may need to use entities for some characters:
            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?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others browsing the Monastery: (8)
    As of 2014-08-28 23:28 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The best computer themed movie is:











      Results (275 votes), past polls