I am learning to use XML::Parser. I am trying to pass a US Weather Service xml file. I can successfully parse it until it dies on me with the following error:
C:\TEMP\xml>perl weather.pl Uncaught exception from user code: not well-formed (invalid token) at line 14580, column 1, byte 477680 at C:/Perl site/lib/XML/Parser.pm line 185 XML::Parser::parsefile('XML::Parser=HASH(0x182f0d4)','us.xml') called a weather.pl line 24 C:\TEMP\xml>perl -c weather.pl weather.pl syntax OK Any help appreciated. This is probably too much infomration but the script is as follows: use strict; use XML::Parser; use diagnostics; use vars qw(@array $xmlfile $count $tag $element); my $xmlfile = "us.xml"; die "Cannot find file \"$xmlfile\"" unless -f $xmlfile; $count = 0; $tag = ""; my $parser = new XML::Parser; $parser->setHandlers( Start => \&startElement, End => \&endElement, Char => \&characterData, Default => \&default); $parser->parsefile($xmlfile); sub startElement { my( $parseinst, $element, %attrs ) = @_; #print "start element: $element\n"; } sub endElement { my( $parseinst, $element ) = @_; #print "end element: $element\n"; } sub characterData { my( $parseinst, $data ) = @_; $data =~ s/\n|\t//g; push @array, $data; # print "$data\n"; } sub default { my( $parseinst, $data ) = @_; } The file I am parsing is at http://www.nws.noaa.gov/alerts/us.cap. _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs