in reply to Perl and XML
Reading the XML::Simple man page helps. Write your expected xml to a file, say, foo.xml, then read and dump it with a script named foo:
use XML::Simple; use Data::Dumper; $Data::Dumper::Indent = 1; my $config = XMLin(); print Dumper($config);
Voilà:
$VAR1 = { 'Node' => [ { 'Type' => 'Module', 'No' => '1', 'File' => 'Sample1.pl', 'Description' => {}, 'Label' => 'AA' }, { 'Type' => 'Methods', 'No' => '2', 'File' => 'Sample1.pl', 'Description' => 'Initiator', 'Label' => 'BB' }, { 'Value' => [ { 'No' => '1', 'content' => 'Ignore' }, { 'No' => '2', 'content' => 'Retry' }, { 'No' => '3', 'content' => 'Abort' } ], 'Type' => 'Methods', 'No' => '3', 'File' => 'Sample2.pl', 'Description' => 'Destructor', 'Label' => 'CC' } ] };
Lather, rinse, repeat.
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl and XML
by Bugz (Acolyte) on Apr 29, 2008 at 17:33 UTC | |
by shmem (Chancellor) on Apr 29, 2008 at 17:58 UTC | |
by Bugz (Acolyte) on Apr 29, 2008 at 19:48 UTC | |
by shmem (Chancellor) on Apr 29, 2008 at 22:17 UTC |