OXIESEC PANEL
- Current Dir:
/
/
home
/
cubot
/
bin
/
etl_odbc
/
test
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
mssql_odbc.pl
528 bytes
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
t3.pl
2.21 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
test.pl
1.45 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
test2.pl
1.95 KB
02/03/2023 07:34:13 AM
rwxr-xr-x
📄
test3.pl
685 bytes
02/03/2023 07:34:13 AM
rw-r--r--
📄
tmpxml.pl
1.49 KB
02/03/2023 07:34:13 AM
rw-r--r--
Editing: tmpxml.pl
Close
sub write_xmldata2csv{ my $srcdir = shift; my $schemafile = shift; my %tabname = (); my @tables = (); my $line = ""; my $i = 0; my @fmt = (); my @cols = (); open(FILE, "$schemafile"); while(<FILE>){#Read Schemafile & Read all tables & columns. $line = $_; @fmt = split /\./, $line; # print @x[0], "===", @x[1], "===", @x[2], "===", "\n"; chomp($fmt[2]); $tabname{$fmt[1]} = $fmt[2]; $tables[$i++] = $fmt[1]; } close(FILE); foreach $root(@tables){#For each table creat FP & write columns into that. open($FP{$root}, ">$STGDIR/$root.dat"); @cols = split /:/, $tabname{$root}; $OUTFP = $FP{$root}; foreach $c(@cols){ print $OUTFP "$c$OUTDELIM"; } print $OUTFP "\n"; } @cols = (); *xmldirfiles = &getdirlist($srcdir, "F"); foreach my $xmlfile(@xmldirfiles){ $xmlfile = $srcdir . "/" . $xmlfile; printlog($INFO, "----- Now Parsing File : $xmlfile -----"); my $xpath = XML::XPath->new(filename => $xmlfile) or $G_ERRMSG = "Can't Process XML File : $xmlfile"; $i = 0; $oldroot = ""; foreach $root(@tables){ # print "</$oldroot$root>\n"; $OUTFP = $FP{$root}; foreach my $row($xpath->findnodes("/$oldroot$root")){ @cols = split /:/, $tabname{$root}; foreach $c(@cols){ if(not defined($tabname{$c})){ $data[$i] = $row->find($c)->string_value; print $OUTFP "$data[$i]$OUTDELIM"; $i++; } #print "-------->$c<-----------\n"; } print $OUTFP "\n"; @data = (); $i = 0; } $oldroot = $oldroot."$root/"; } } }