xml auslesen und in Matrix ausgeben
|
Seitenanfang |
HAllo Perlprogramierer, ich versuche seit Tagen eine xmlDatei mit auszulesen und in einer Matrix auszugeben abr leider habe ich bis jetzt nicht geschaft habt ihr da eine Idee wie ich das machen kann??Bitte, Bitte hier ist das XmLFilecode(siehe unten) und zwar was mich genau interessiert ist InHalt von Steps (Pre):<Root_Element> <FileDescription> <Fileversion>1.0</Fileversion> </FileDescription> <Settings> <StandLogPath>C:\Platfor....</StandLogPath> </Settings> <Pre> <Steps> <Typ>Adm........</Typ> <Source/> <Destination/> <Run/> <Step>1</Step> <Comment>checks</Comment> </Steps> <Steps> <Typ>MD</Typ> <Destination>C:\win16app</Destination> <Step>2</Step> </Steps> <Steps> <Typ>MD</Typ> <Destination>"C:\Documents and Settings\All .......</Destination> <Step>3</Step> </Steps> <Steps> <Typ>MD</Typ> <Destination>"C:\Documents and Settings\All ...............</Destination> <Step>4</Step> </Steps> <Steps> <Typ>MD</Typ> <Destination>"C:\Documents and Settings\A................."</Destination> <Step>5</Step> </Steps> </Pre> </Root_Element>
Datum: 19.04.2007-10:33

|
re: xml auslesen und in Matrix ausgeben
|
Seitenanfang |
das muss nicht als Matrix asgegeben werden, nur halt es wäre besser. ;-(
Datum: 19.04.2007-12:44

|
re: xml auslesen und in Matrix ausgeben
|
Seitenanfang |
na dann zeig mal, was du bisher programmiert hast... wir wollen dir ja helfen, besser zu werden und dir keine fertige lösung liefern :-)
Datum: 19.04.2007-12:53

|
re: xml auslesen und in Matrix ausgeben
|
Seitenanfang |
du hast recht, hier kannst du sehen: hier bekomme ich aber nur die erste Zeile??? use StandLib; use strict; my $ConfigFileName = @ARGV[0]; my $retval = StandLib::ReadXMLFile ('noname.xml'); my @NodeNames={}; my @NodeValues={}; my $CountPre=StandLib::GetCountOfNodes('Pre'); my $Counttel=StandLib::GetCountOfNodes('Steps'); for (my $i=0; $i<$CountPre;$i++) { @NodeValues=StandLib::GetALLNodeValues('Steps',$i); print ("@NodeValues"); print"\n"; }
Datum: 20.04.2007-08:26

|
re: xml auslesen und in Matrix ausgeben
|
Seitenanfang |
uns so bekomme ich aber das Inhalt von alle Steps iin xmlDateien. ich möchte aber nur die in dem Pre Teil sind !!! hier ist wieder der Code:my $CountPre=StandLib::GetCountOfNodes('Pre'); my $Counttel=StandLib::GetCountOfNodes('Steps'); for (my $i=0; $i<$CountSteps;$i++) { @NodeValues=StandLib::GetALLNodeValues('Steps',$i); print ("@NodeValues"); print"\n"; }
Datum: 20.04.2007-08:32

|
re: xml auslesen und in Matrix ausgeben
|
Seitenanfang |
| jetzt habe ich geschaft: my $CountPre=StandLib::GetCountOfNodes('Pre'); my $CountSteps=StandLib::GetCountOfNodes('Steps'); @NodeValues=StandLib::GetALLNodeValues('Pre',$i); my $maxindex = @NodeValues; for (my $i=0; $i<$maxindex -1;$i++) { @NodeValues=StandLib::GetALLNodeValues('Steps',$i); print ("@NodeValues"); print"\n"; } wunderbar es hat geklapt.
Datum: 20.04.2007-09:57

|
re: xml auslesen und in Matrix ausgeben
|
Seitenanfang |
| kann mir hier jemand bitte helfen??warum kommt hier kein Fehler und das Mehrdimensionale Array wird nicht geprintet?? my ($x, $y, ); @NodeValues = StandLib::GetALLNodeValues('Pre',$i); my $maxindex = @NodeValues; my @PreArray; for (my $i=0; $i<$maxindex -1;$i++) { @NodeValues=StandLib::GetALLNodeValues('Steps',$i); print @NodeValues; print "\n"; @PreArray =(\@NodeValues[0..-1]); } print "@{$_}\n" for @PreArray;
Datum: 20.04.2007-11:06

|