#### my $reader = new XML::LibXML::Reader(location => "$XMLfile") or die "cannot read $XMLfile\n"; while ( $reader->nextElement( 'MktDataFull' )) { my $RptID = $reader->getAttribute('RptID'); my $BizDt = $reader->getAttribute('BizDt'); $reader->read; while ( $reader->nextElement( 'Instrmt' )) { my $Sym = $reader->getAttribute('Sym'); my $MMY = $reader->getAttribute('MMY'); $reader->read; while (1) { if ($reader->localName eq 'Full') { $Typ =
$reader->getAttribute('Typ'); } $reader->nextSibling() > 0 or last; } $fileLine = $RptID . "," . $BizDt . "," . $Sym . "," . $MMY . "," . $MatDt . "," . $CFI_recType . "," . $Typ4Dt; print CSVOUT "$fileLine\n"; } $reader->nextSibling() > 0 or last; }