Omniscient Monks,

I try to use XML::Simple :-)
my $xml = XML::Simple->new(); my $xml_Load = $xml->XMLin("Input.xml"); print Dumper $xml_Load; $xml->XMLout($xml_Load,OutputFile => "Output.xml");
Input.xml
<opt> <global> <glob1 value="g1v" /> <glob2 value="g2v" /> <glob3 value="g3v" /> </global> <parmsets> <example> <local> <location value="location" /> <loc2 value="loc2v" /> <loc3 value="loc3v" /> </local> <regional> <region1 value="region1v" /> <region2 value="region2v" /> <region3 value="region3v" /> </regional> </example> </parmsets> </opt>
Output.xml
<opt> <global name="glob1" value="g1v" /> <global name="glob2" value="g2v" /> <global name="glob3" value="g3v" /> <parmsets name="example"> <local name="loc2" value="loc2v" /> <local name="loc3" value="loc3v" /> <local name="location" value="location" /> <regional name="region1" value="region1v" /> <regional name="region2" value="region2v" /> <regional name="region3" value="region3v" /> </parmsets> </opt>
i´m not able to force xml::simple to keep the structure of the input file..
even if i use the output structure i get really big troubles if there is only one note in <parmsets>
because xmlin did not mention it as a hash anymore..

anybody got an leading idea ?

$perlig =~ s/pec/cep/g if 'errors expected';

In reply to XML::Simple Usage by AlexTape

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!
  • 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, details, 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, summary, 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.