Seth wrote:
> I have an existing xml file that I need to display. Perl was
> suggested a good way to do that.
>
> I am using XML::Simple. None of the examples use the format that I
> have.
>
> Here is an example of what I am dealing with:
>
> <config>
> <param name="SequenceNumber">66</param>
> <param name="T1">6</param>
> <param name="T3">6</param>
> <param name="T4">540</param>
> <param name="DownloadDate">11-28-07</param>
> </config>
>
> I can use Dumper to see that it has been loaded but can't figure out
> how to navigate the structure.
> Any help would be great.
IMO XML::Simple is anything but simple to use, but the program below may
help. I can't suggest any more without knowing what sort of output you
need.
Rob
use strict;
use warnings;
use XML::Simple;
my $xml = <<XML;
<config>
<param name="SequenceNumber">66</param>
<param name="T1">6</param>
<param name="T3">6</param>
<param name="T4">540</param>
<param name="DownloadDate">11-28-07</param>
</config>
XML
my $tree = XMLin($xml);
use Data::Dumper;
foreach my $item (keys %{$tree->{param}}) {
printf "%s => %s\n", $item, $tree->{param}{$item}{content};
}
**OUTPUT**
T4 => 540
T1 => 6
SequenceNumber => 66
DownloadDate => 11-28-07
T3 => 6
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/