blob: 89fcd8b248b8ce87d4bac88449f5ac0bb679f83c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# $Id: Debug.pm,v 1.1 2003/07/27 16:07:49 matt Exp $
package XML::Parser::Style::Debug;
use strict;
sub Start {
my $expat = shift;
my $tag = shift;
print STDERR "@{$expat->{Context}} \\\\ (@_)\n";
}
sub End {
my $expat = shift;
my $tag = shift;
print STDERR "@{$expat->{Context}} //\n";
}
sub Char {
my $expat = shift;
my $text = shift;
$text =~ s/([\x80-\xff])/sprintf "#x%X;", ord $1/eg;
$text =~ s/([\t\n])/sprintf "#%d;", ord $1/eg;
print STDERR "@{$expat->{Context}} || $text\n";
}
sub Proc {
my $expat = shift;
my $target = shift;
my $text = shift;
my @foo = @{$expat->{Context}};
print STDERR "@foo $target($text)\n";
}
1;
__END__
=head1 NAME
XML::Parser::Style::Debug - Debug style for XML::Parser
=head1 SYNOPSIS
use XML::Parser;
my $p = XML::Parser->new(Style => 'Debug');
$p->parsefile('foo.xml');
=head1 DESCRIPTION
This just prints out the document in outline form to STDERR. Nothing special is
returned by parse.
=cut
|