develooper Front page | perl.beginners | Postings from October 2009

xml simple question

Thread Next
From:
getget
Date:
October 23, 2009 05:17
Subject:
xml simple question
Message ID:
7fe8fbf0-29e2-4523-826b-9c5cef4d2988@u36g2000prn.googlegroups.com
Hi All.
When using XML::Sample, I have a question, who can help me.

First I have output.xml file:
<?xml version="1.0"?>
<memo>
  <applications>
    <multimedia>
        <application>Mp3 converter</application>
        <application>Real player</application>
    </multimedia>
    <office>
        <application>Microsoft project</application>
        <application>Poedit</application>
    </office>
  </applications>
  <games>
    <game>Metrix</game>
    <game>Line</game>
    <game>Sudoku</game>
  </games>
</memo>

I use XML::Sample to read, after that I save to output.xml
$data= XMLin("input.xml");
print XMLout($data,  xmldecl => '<?xml version="1.0"?>', RootName =>
'memo', OutputFile => 'output.xml');

Content of output.xml file:
<?xml version="1.0"?>
<config>
  <applications>
    <name>multimedia</name> <!-- different -->
    <application>Mp3 converter</application>
    <application>Real player</application>
  </applications>
  <applications>
    <name>office</name><!-- different -->
    <application>Microsoft project</application>
    <application>Poedit</application>
  </applications>
  <games>
    <game>Metrix</game>
    <game>Line</game>
    <game>Sudoku</game>
  </games>
</config>

The content of 2 files output.xml and input.xml are different. How can
I create the output file its content the same with input.xml.

Cheers


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About