Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong handler called for characters at the end of the document [rt.cpan.org #46685] #47

Open
toddr opened this issue Sep 24, 2019 · 1 comment
Labels

Comments

@toddr
Copy link
Member

toddr commented Sep 24, 2019

Migrated from rt.cpan.org#46685 (status was 'new')

Requestors:

Attachments:

From [email protected] on 2009-06-05 08:38:32
:

Valid characters (spaces/new lines) after the last closing tag of the
document trigger the Default handler instead of the Char handler.

The attached file shows that behaviour.
__
mirod

@toddr
Copy link
Member Author

toddr commented Sep 24, 2019

#!/usr/bin/perl

use strict;
use warnings;
 
use XML::Parser;

my $p=XML::Parser->new( Handlers => { Char    => sub { printf "char    : [%s]\n", show_lf( $_[1]);}, 
                                      Default => sub { printf "default : [%s]\n", show_lf( $_[1]);}, 
                                    }
                       ); 

$p->parse( "<doc>foo</doc>\n \n");

sub show_lf
  { my( $string)= @_;
    $string=~ s{\n}{\\n}g;
    return $string;
  }

@toddr toddr added the Has Test label Sep 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant