in reply to Splitting xml file into multiple files
xml_split has all ready been given and is probably the best choice for simple splitting; however, if you're looking to upgrade your XML toolkit, then XML::LibXML is a good choice and something along the lines of below should get you started.
#!/usr/bin/perl use XML::LibXML; my $file = shift || die "usage $0 <xmlfile>"; my $parser = XML::LibXML->new(); my $doc = $parser->parse_file( $file ); my $nodes = $doc->findnodes( '/TheRoot/Message' ); foreach my $node ( @$nodes ) { print $node->toString(); }
|
|---|