sama has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/local/bin/perl use strict; (my $prog = $0) =~ s-.*/--; my $usage = "USAGE: $prog xml_file"; @ARGV == 1 or die "$usage\n"; # $xml_file = http://www.statenet.com/sama/BILLTEXT_20011025_0_N.xml my ($xml_file) = shift; unless (-f "$xml_file" ) { die "$prog: FATAL: File: $xml_file does not exist\n"; } use DBI; use XML::Twig; my $twig = XML::Twig->new( pretty_print => 'indented', load_DTD => 1, ); unless ( $twig->safe_parsefile($xml_file) ) { die "$prog: FATAL: Failed parse of $xml_file...\n"; } my $root = $twig->root(); my $billtext = $root->children('billtext'); my $version_date_xml = $billtext->first_child('billtext_version_date') +; my $version_date = $version_date_xml->text; my $verseq = parse XML::Twig::Elt("<billtext_version_sequence>0</billt +ext_version_sequence>"); $verseq->paste(after => $version_date_xml); $twig->flush(Update_DTD => 1); # print(STDERR "Hey, look, I still haven't dumped core!!!\n");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Twig dumping core on valid XML...
by samtregar (Abbot) on Nov 30, 2005 at 19:36 UTC | |
|
Re: XML::Twig dumping core on valid XML...
by Tanktalus (Canon) on Nov 30, 2005 at 20:32 UTC |