Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
My own timid excursion into XML was made for two reasons:

  1. Tied hashes between two systems (e.g. my hosted website and my local mirror) can be incompatible, depending on the db engines employed.
  2. Tied hashes normally encompass only one level. Hashes containing arrays and other hashes can be cumbersome to implement.

What I was hoping to achieve was a portable, readable file capable of containing a complex Perl data structure, that I could slurp into memory, manipulate, and write back out.

XML::Simple is the putative answer to these goals. It was pretty simple, but not brain-dead simple. Some of the arrays embedded in my hash have only one element. Apparently XML, by itself, is unable to distinguish between a single-element array and a scalar, so there is no a priori one-to-one correspondence between plain XML and a Perl data structure. XML::Simple gives you a way to force certain elements to be arrays when the XML file is read, but this amount of finagling was contrary to my objectives.

Would I use XML again? Probably not as a general-purpose embodiment of a Perl data structure. For that, I would look around for another format, another module -- or write my own. But my mind is still open for other applications. With this much smoke and heat, there's gotta be a fire somewhere!

In reply to Re: XML for databases?!?! Is it just me or is the rest of the world nutz? by Dr. Mu
in thread XML for databases?!?! Is it just me or is the rest of the world nutz? by S_Shrum

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
    Jar. Jar!...

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (1)
    As of 2018-04-24 04:08 GMT
    Find Nodes?
      Voting Booth?