3
Target
P6
12
Good
P6
,
####
!/usr/bin/perl
# open an output file
unless (open (OUTFILE, ">testoutput.xml")){
die ("Cannot open output file testoutput.xml\n");
}
use XML::Simple;
my $file = "infile.xml";
my $xs1 = XML::Simple->new();
my $doc = $xs1->XMLin($file);
foreach my $key (keys (%{$doc->{document}})){
print $doc->{document}->{$key}->{'datetime'}, ",",
'(' . $key . ')', ",",
$doc->{document}->{$key}->{sourcecategory}, ",",
$doc->{document}->{$key}->{schemeversion}, ",", "\n";
}
####
2006/01/25,\2006\200601\20060125\20060125_18.txt,News Archive,1.1
####
2006/01/25,\2006\200601\20060125\20060125_18.txt,News Archive,1.1
2006/01/25,\2006\200601\20060125\20060125_19.txt,News Archive,1.1,3,Target,P6
2006/01/25,\2006\200601\20060125\20060125_19.txt,News Archive,1.1,12,Good,P6