awohld has asked for the wisdom of the Perl Monks concerning the following question:
See that the output doesn't have all the data... the last <test id="1"> overwrote the first.#!/usr/bin/perl use warnings; use strict; use XML::Simple; use Data::Dumper; my $xml = do{ local $/; <DATA> }; print Dumper XMLin($xml); __DATA__ <?xml version="1.0" encoding="UTF-8"?> <root> <test id="1"> <first id="white">Mike</first> </test> <test id="1"> <last id="black">Gifford</last> </test> </root>
$VAR1 = { 'test' => { '1' => { 'last' => { 'content' => 'Gifford', 'id' => 'black' } } } };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Simple - Duplicate Node Overwrites
by wind (Priest) on Apr 23, 2011 at 06:57 UTC | |
by awohld (Hermit) on Apr 23, 2011 at 07:28 UTC | |
by wind (Priest) on Apr 23, 2011 at 07:36 UTC | |
by ikegami (Patriarch) on Apr 23, 2011 at 07:59 UTC | |
by Anonymous Monk on Apr 23, 2011 at 08:07 UTC | |
|