XML::Parser Q: The Char handler always returns '1'



Here is the code fragments:

==============================================================
# Parser command
my $parser = new XML::Parser (ErrorContext => 2);
$parser->setHandlers(Start => \&start_handler
, Char => \&char_handler
, End => \&end_handler
, Default => \&default_handler
);
$retVal = $parser->parsefile($file);
....
sub char_handler {
my ($p, $data) = @_;

print "char_handler: data = *$data*\n";
==============================================================

The last print statement always prints '1' with the following input
(even for NAME or VALUE fields). Subroutines for Start or End seem to
work just fine.

==============================================================
<P1>
<T1> T1_TXT </T1>
<F1>
<F2>
<NAME> MY_NAME </NAME>
<VALUE> 1 </VALUE>
</F2>
....
==============================================================

Any help will be greatly appreciated.
.



Relevant Pages

  • Re: XML::Parser Q: The Char handler always returns 1
    ... sub char_handler { ... The last print statement always prints '1' with the following input ... jgibson 55% cat swapnajit.txt ...
    (comp.lang.perl.misc)
  • XML::Parser Q: The Char handler always returns 1
    ... Here is the code fragments: ... sub char_handler { ... The last print statement always prints '1' with the following input ...
    (comp.lang.perl.misc)
  • Re: Chat client/server print failed
    ... putting a print statement in the wait_for_msg sub and it only printed ... It dawned on me in a dream, that using a timer to keep the socket ... #add a Gtk2::Helper watch on any incomming connections ...
    (comp.lang.perl.misc)
  • Re: Print with no line feed
    ... If you look carefully at the second one, you will see a semi-colon after the Print statement argument... ... > Sub Write2() ...
    (microsoft.public.excel.programming)
  • Re: Click link to go to routine
    ... routine I mean a subroutine that is in the same file as the print statement. ... sub return_this { ...
    (comp.lang.perl.misc)