Last change
on this file since 31809 was 31809, checked in by ak19, 7 years ago |
Added the XML-Parser for perl 5.22 as well for the release-kit to include in binaries. Note that, just as for the perl-5.24 version committed before, the auto/XML/Parser/Expat.bs (bootstrap file?) is copied from the perl 5.18 that was committed much longer ago, since the .bs file didn't differ between 5.10 and 5.18.
|
File size:
982 bytes
|
Rev | Line | |
---|
[31809] | 1 | # $Id: Debug.pm,v 1.1 2003-07-27 16:07:49 matt Exp $
|
---|
| 2 |
|
---|
| 3 | package XML::Parser::Style::Debug;
|
---|
| 4 | use strict;
|
---|
| 5 |
|
---|
| 6 | sub Start {
|
---|
| 7 | my $expat = shift;
|
---|
| 8 | my $tag = shift;
|
---|
| 9 | print STDERR "@{$expat->{Context}} \\\\ (@_)\n";
|
---|
| 10 | }
|
---|
| 11 |
|
---|
| 12 | sub End {
|
---|
| 13 | my $expat = shift;
|
---|
| 14 | my $tag = shift;
|
---|
| 15 | print STDERR "@{$expat->{Context}} //\n";
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | sub Char {
|
---|
| 19 | my $expat = shift;
|
---|
| 20 | my $text = shift;
|
---|
| 21 | $text =~ s/([\x80-\xff])/sprintf "#x%X;", ord $1/eg;
|
---|
| 22 | $text =~ s/([\t\n])/sprintf "#%d;", ord $1/eg;
|
---|
| 23 | print STDERR "@{$expat->{Context}} || $text\n";
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | sub Proc {
|
---|
| 27 | my $expat = shift;
|
---|
| 28 | my $target = shift;
|
---|
| 29 | my $text = shift;
|
---|
| 30 | my @foo = @{$expat->{Context}};
|
---|
| 31 | print STDERR "@foo $target($text)\n";
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | 1;
|
---|
| 35 | __END__
|
---|
| 36 |
|
---|
| 37 | =head1 NAME
|
---|
| 38 |
|
---|
| 39 | XML::Parser::Style::Debug - Debug style for XML::Parser
|
---|
| 40 |
|
---|
| 41 | =head1 SYNOPSIS
|
---|
| 42 |
|
---|
| 43 | use XML::Parser;
|
---|
| 44 | my $p = XML::Parser->new(Style => 'Debug');
|
---|
| 45 | $p->parsefile('foo.xml');
|
---|
| 46 |
|
---|
| 47 | =head1 DESCRIPTION
|
---|
| 48 |
|
---|
| 49 | This just prints out the document in outline form to STDERR. Nothing special is
|
---|
| 50 | returned by parse.
|
---|
| 51 |
|
---|
| 52 | =cut |
---|
Note:
See
TracBrowser
for help on using the repository browser.