1Parser::Style::Stream(3U)ser Contributed Perl DocumentatiPoanrser::Style::Stream(3)
2
3
4

NAME

6       XML::Parser::Style::Stream - Stream style for XML::Parser
7

SYNOPSIS

9         use XML::Parser;
10         my $p = XML::Parser->new(Style => 'Stream', Pkg => 'MySubs');
11         $p->parsefile('foo.xml');
12
13         {
14           package MySubs;
15
16           sub StartTag {
17             my ($e, $name) = @_;
18             # do something with start tags
19           }
20
21           sub EndTag {
22             my ($e, $name) = @_;
23             # do something with end tags
24           }
25
26           sub Characters {
27             my ($e, $data) = @_;
28             # do something with text nodes
29           }
30         }
31

DESCRIPTION

33       This style uses the Pkg option to find subs in a given package to call
34       for each event.  If none of the subs that this style looks for is
35       there, then the effect of parsing with this style is to print a
36       canonical copy of the document without comments or declarations.  All
37       the subs receive as their 1st parameter the Expat instance for the
38       document they're parsing.
39
40       It looks for the following routines:
41
42       ·   StartDocument
43
44           Called at the start of the parse .
45
46       ·   StartTag
47
48           Called for every start tag with a second parameter of the element
49           type. The $_ variable will contain a copy of the tag and the %_
50           variable will contain attribute values supplied for that element.
51
52       ·   EndTag
53
54           Called for every end tag with a second parameter of the element
55           type. The $_ variable will contain a copy of the end tag.
56
57       ·   Text
58
59           Called just before start or end tags with accumulated non-markup
60           text in the $_ variable.
61
62       ·   PI
63
64           Called for processing instructions. The $_ variable will contain a
65           copy of the PI and the target and data are sent as 2nd and 3rd
66           parameters respectively.
67
68       ·   EndDocument
69
70           Called at conclusion of the parse.
71
72
73
74perl v5.32.0                      2020-07-28          Parser::Style::Stream(3)
Impressum