where the file xmlinput contained:use strict; use XML::Simple; use Data::Dumper; while (<>) { next if /xml|ArgusDataStream/; my $xml=$_; $xml.=<> while $xml !~ m|</ArgusFlowRecord>|; my $xmlhash=XMLin($xml); print Dumper($xmlhash); } __END__ $ xmlstuff.pl <xmlinput $VAR1=' Flow data set 1 '; $VAR1=' Flow data set 2 ';
Your XML processing will of course be completely different (and probably not use XML::Simple), but this should give you an idea on how to proceed.<?xml version="1.0"> <ArgusDataStream> <ArgusFlowRecord> Flow data set 1 </ArgusFlowRecord> <ArgusFlowRecord> Flow data set 2 </ArgusFlowRecord> </ArgusDataStream>
Update: this is basically the same as marcello's solution, and is probably better handled with an event based parser such as XML::Sax::PurePerl, as per jeffa's suggestion in the chatterbox.
CU
Robartes-
In reply to Re: Record based XML stream processing?
by robartes
in thread Record based XML stream processing?
by fs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |