Mr. Muskrat has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to process the stats for my Seti@home group using XML::Twig.
However, I am getting an error 'not well-formed at line 99, column 22, byte 3613 at C:/Perl/site/lib/XML/Parser.pm line 168'
Here is the groupstats DTD and the XML I am attempting to parse is here.
I am just getting started learning about XML so my code is pretty basic (and based on an example I saw at mirod's XMLTwig site):
#!/usr/bin/perl -w use strict; use XML::Twig; my $count = 0; # total count of members to compare against my $t= XML::Twig->new( twig_handlers => { member => \&member } ); $t->parsefile('kwsn.xml'); $t->flush; # don't forget to flush one last time in the end or anythin +g # after the last </section> tag will not be output print "Total members: $count\n"; sub member { my ($t, $member) = @_; my $name = field($member, 'name'); # get member's name my $results = field($member, 'numresults'); # get member's results print "$name $results\n"; $t->purge(); $count++; } sub field { my ($member, $field) = @_; return $member->first_child($field)->text; }
What can I do to keep this from happening?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: 'not well-formed' using XML::Twig
by traveler (Parson) on Dec 24, 2002 at 19:10 UTC | |
|
Re: 'not well-formed' using XML::Twig
by mirod (Canon) on Dec 25, 2002 at 01:28 UTC | |
|
Re: 'not well-formed' using XML::Twig
by Aristotle (Chancellor) on Dec 24, 2002 at 19:04 UTC | |
|
Re: 'not well-formed' using XML::Twig
by Mr. Muskrat (Canon) on Dec 27, 2002 at 03:03 UTC | |
|
Re: 'not well-formed' using XML::Twig
by Mr. Muskrat (Canon) on Dec 27, 2002 at 17:19 UTC | |
by Mr. Muskrat (Canon) on Jan 02, 2003 at 23:38 UTC |