Hi Programierer,
ich möchte eine xml-datei mit Perl auslesen und das Ganze in einem Array packen.
ich habe es mit sowas versucht aber ich bin leider nur ein Anfänger.Bitte sagt mir was ich hier falsch mache?# Mein Code
use StandLib;
use strict;
use warnings;
use Data::Dumper;
my $TestFileName = $ARGV[0];
my $retval = StandLib::ReadXMLFile ($TestFileName);
if ($retval != 0)
{ exit($retval);}
my @NodeNames = {}; # Names from Xmlfile
my @NodeValues = {}; # Values from Xmlfile
my $CountProgram=StandLib::GetCountOfNodes('Program'); # Counts programs
my $CountPlatform=StandLib::GetCountOfNodes('Platform'); # Counts Platforms
my $CountSteps=StandLib::GetCountOfNodes('Steps'); # Counts Steps
my $CountPre=StandLib::GetCountOfNodes('Pre'); # Counts pre
my $CountStepp=StandLib::GetCountOfNodes('Stepp');
my ($fPlat, $mw, @checkedProgs, @checkedSteps);
my ($tl, $doc);
my $Exit;
#------All Programs = 0 -----------------------
foreach my $i (0..($CountProgram-1))
{
$checkedProgs[$i]= 0;
}
#------All Steps = 0 --------------------------
foreach my $i (0..($CountSteps-1))
{
$checkedSteps[$i] = 0;
}
############
foreach my $i (0..($CountPre-1))
{
my $x = 0; my $y; my @tempArrayCheck;
@NodeValues=StandLib::GetALLNodeValues('Pre',$i);
@tempArrayCheck = @NodeValues;
for ($y = 0; $y<@NodeValues;$y++)
{ # Elements of xmlFile in Array ($tempArray)
$tempArrayCheck[$x][$y]=$NodeValues[$y];
}
#print "@{$_}\n" for $tempArrayCheck[$x][$y];
}
Datum: 16.04.2007-17:44
