| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package XML::ExtOn::Element; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
#$Id: Element.pm 845 2010-10-13 08:11:10Z zag $ |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=pod |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
XML::ExtOn::Element - Class for Element object. |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSYS |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use XML::ExtOn; |
|
14
|
|
|
|
|
|
|
my $buf; |
|
15
|
|
|
|
|
|
|
my $wrt = XML::ExtOn::Writer->new( Output => \$buf ); |
|
16
|
|
|
|
|
|
|
my $ex_parser = new XML::ExtOn:: Handler => $wrt; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
... |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#create Element |
|
21
|
|
|
|
|
|
|
my $elem = $ex_parser->mk_element("Root"); |
|
22
|
|
|
|
|
|
|
$elem->add_content( $elem->mk_element("tag1")); |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
... |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
#delete tag from XML |
|
27
|
|
|
|
|
|
|
$elem->delete_element; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
... |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
#delete tag from XML and skip content |
|
32
|
|
|
|
|
|
|
$elem->delete_element->skip_content; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
... |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
#set default namespace( scoped in element ) |
|
37
|
|
|
|
|
|
|
$elem->add_namespace(''=>"http://example.com/defaultns"); |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
... |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
#get attribites by prefix |
|
42
|
|
|
|
|
|
|
my $hash_ref = $elem->attrs_by_prefix('myprefix'); |
|
43
|
|
|
|
|
|
|
$hash_ref->{attr1} = 1; |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
$ex_parser->start_element($elem) |
|
46
|
|
|
|
|
|
|
$ex_parser->end_element; |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 METHODS |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
|
51
|
|
|
|
|
|
|
|
|
52
|
8
|
|
|
8
|
|
2806
|
use strict; |
|
|
8
|
|
|
|
|
26
|
|
|
|
8
|
|
|
|
|
372
|
|
|
53
|
8
|
|
|
8
|
|
79
|
use warnings; |
|
|
8
|
|
|
|
|
14
|
|
|
|
8
|
|
|
|
|
237
|
|
|
54
|
|
|
|
|
|
|
|
|
55
|
8
|
|
|
8
|
|
45
|
use Carp; |
|
|
8
|
|
|
|
|
13
|
|
|
|
8
|
|
|
|
|
591
|
|
|
56
|
8
|
|
|
8
|
|
43
|
use Data::Dumper; |
|
|
8
|
|
|
|
|
30
|
|
|
|
8
|
|
|
|
|
470
|
|
|
57
|
8
|
|
|
8
|
|
3240
|
use XML::ExtOn::TieAttrs; |
|
|
8
|
|
|
|
|
17
|
|
|
|
8
|
|
|
|
|
226
|
|
|
58
|
8
|
|
|
8
|
|
4181
|
use XML::ExtOn::Attributes; |
|
|
8
|
|
|
|
|
20
|
|
|
|
8
|
|
|
|
|
206
|
|
|
59
|
8
|
|
|
8
|
|
67
|
use XML::ExtOn::Element; |
|
|
8
|
|
|
|
|
15
|
|
|
|
8
|
|
|
|
|
328
|
|
|
60
|
|
|
|
|
|
|
for my $key (qw/ _context attributes _skip_content _delete_element _stack _wrap_begin _wrap_end _wrap_around_start _wrap_around_end/) { |
|
61
|
8
|
|
|
8
|
|
39
|
no strict 'refs'; |
|
|
8
|
|
|
|
|
13
|
|
|
|
8
|
|
|
|
|
3405
|
|
|
62
|
|
|
|
|
|
|
*{ __PACKAGE__ . "::$key" } = sub { |
|
63
|
32
|
|
|
32
|
|
40
|
my $self = shift; |
|
64
|
32
|
100
|
|
|
|
113
|
$self->{$key} = $_[0] if @_; |
|
65
|
32
|
|
|
|
|
124
|
return $self->{$key}; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# new name=>< element name>, context=>< context >[, sax2=>[] ] |
|
70
|
|
|
|
|
|
|
# |
|
71
|
|
|
|
|
|
|
#Create Element object |
|
72
|
|
|
|
|
|
|
# |
|
73
|
|
|
|
|
|
|
# my $element = new XML::ExtOn::Element:: |
|
74
|
|
|
|
|
|
|
# name => "p", |
|
75
|
|
|
|
|
|
|
# context => $context, |
|
76
|
|
|
|
|
|
|
# [sax2 => $t1_elemnt ]; |
|
77
|
|
|
|
|
|
|
# |
|
78
|
|
|
|
|
|
|
# |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub new { |
|
81
|
3
|
|
|
3
|
0
|
27
|
my ( $class, %attr ) = @_; |
|
82
|
3
|
|
|
|
|
8
|
my $self = bless {}, $class; |
|
83
|
3
|
50
|
|
|
|
11
|
$self->_context( $attr{context} ) or die "not exists context parameter"; |
|
84
|
3
|
|
|
|
|
5
|
my $name = $attr{name}; |
|
85
|
3
|
50
|
|
|
|
9
|
$self->attributes( |
|
86
|
|
|
|
|
|
|
new XML::ExtOn::Attributes:: |
|
87
|
|
|
|
|
|
|
context => $self->_context, |
|
88
|
|
|
|
|
|
|
sax2 => exists $attr{sax2} ? $attr{sax2}->{Attributes} : {} |
|
89
|
|
|
|
|
|
|
); |
|
90
|
|
|
|
|
|
|
|
|
91
|
3
|
50
|
|
|
|
10
|
if ( my $sax2 = $attr{sax2} ) { |
|
92
|
3
|
|
66
|
|
|
15
|
$name ||= $sax2->{Name}; |
|
93
|
3
|
|
100
|
|
|
17
|
my $prefix = $sax2->{Prefix} || ''; |
|
94
|
3
|
|
|
|
|
12
|
$self->set_prefix( ); |
|
95
|
3
|
|
|
|
|
9
|
$self->set_ns_uri( $self->ns->get_uri( $prefix ) ); |
|
96
|
|
|
|
|
|
|
} |
|
97
|
3
|
|
|
|
|
13
|
$self->_stack([]); |
|
98
|
3
|
|
|
|
|
12
|
$self->_wrap_around_start([]); |
|
99
|
3
|
|
|
|
|
8
|
$self->_wrap_around_end([]); |
|
100
|
3
|
|
|
|
|
43
|
$self->_wrap_begin([]); |
|
101
|
3
|
|
|
|
|
12
|
$self->_wrap_end([]); |
|
102
|
3
|
|
|
|
|
7
|
$self->_set_name($name); |
|
103
|
3
|
|
|
|
|
9
|
return $self; |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub __clone1 { |
|
107
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
|
108
|
0
|
|
|
|
|
0
|
my $class = ref( $self); |
|
109
|
0
|
|
|
|
|
0
|
my %hash = %$self; |
|
110
|
0
|
|
|
|
|
0
|
my $selfc = bless \%hash, $class; |
|
111
|
0
|
|
|
|
|
0
|
$selfc->_wrap_end([]); |
|
112
|
0
|
|
|
|
|
0
|
$selfc->_wrap_begin([]); |
|
113
|
0
|
|
|
|
|
0
|
return $selfc; |
|
114
|
|
|
|
|
|
|
} |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub __clone { |
|
117
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
|
118
|
0
|
|
|
|
|
0
|
my $class = ref( $self); |
|
119
|
0
|
|
|
|
|
0
|
my %hash = (); |
|
120
|
8
|
|
|
8
|
|
6327
|
use Tie::UnionHash; |
|
|
8
|
|
|
|
|
8310
|
|
|
|
8
|
|
|
|
|
8283
|
|
|
121
|
0
|
|
|
|
|
0
|
tie %hash, 'Tie::UnionHash', $self, {}; |
|
122
|
0
|
|
|
|
|
0
|
my $selfc = bless \%hash, $class; |
|
123
|
0
|
|
|
|
|
0
|
$selfc->_wrap_end([]); |
|
124
|
0
|
|
|
|
|
0
|
$selfc->_wrap_begin([]); |
|
125
|
0
|
|
|
|
|
0
|
$selfc->_wrap_around_start([]); |
|
126
|
0
|
|
|
|
|
0
|
$selfc->_wrap_around_end([]); |
|
127
|
0
|
|
|
|
|
0
|
$selfc->_stack([]); |
|
128
|
0
|
|
|
|
|
0
|
return $selfc; |
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub _set_name { |
|
133
|
3
|
|
|
3
|
|
5
|
my $self = shift; |
|
134
|
3
|
|
50
|
|
|
10
|
$self->{__name} = shift || return $self->{__name}; |
|
135
|
|
|
|
|
|
|
} |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head2 add_content [, ...] |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Add commands to contents stack.Return C<$self> |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
$elem->add_content( |
|
142
|
|
|
|
|
|
|
$self->mk_from_xml(""), |
|
143
|
|
|
|
|
|
|
$self->mk_cdata("TEST CDATA"), |
|
144
|
|
|
|
|
|
|
) |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=cut |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub add_content { |
|
149
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
150
|
0
|
|
|
|
|
0
|
push @{$self->_stack()}, @_; |
|
|
0
|
|
|
|
|
0
|
|
|
151
|
0
|
|
|
|
|
0
|
return $self |
|
152
|
|
|
|
|
|
|
} |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head2 insert_to |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Wrap by C.Return C<$self> |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
$elem->insert_to( $self->mk_element('wrap') ) |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=cut |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub insert_to { |
|
163
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
164
|
0
|
0
|
|
|
|
0
|
if ( @_ ) { |
|
165
|
0
|
|
|
|
|
0
|
push @{$self->_wrap_begin()}, @_; |
|
|
0
|
|
|
|
|
0
|
|
|
166
|
0
|
|
|
|
|
0
|
push @{$self->_wrap_end()}, @_ |
|
|
0
|
|
|
|
|
0
|
|
|
167
|
|
|
|
|
|
|
} |
|
168
|
0
|
|
|
|
|
0
|
return $self |
|
169
|
|
|
|
|
|
|
} |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head2 wrap_around (element object) |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Wrap around C.Return C<$self> |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=cut |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
sub wrap_around { |
|
178
|
0
|
|
|
0
|
1
|
0
|
my $self= shift; |
|
179
|
0
|
0
|
|
|
|
0
|
if ( @_ ) { |
|
180
|
0
|
|
|
|
|
0
|
push @{$self->_wrap_around_start()}, @_; |
|
|
0
|
|
|
|
|
0
|
|
|
181
|
0
|
|
|
|
|
0
|
push @{$self->_wrap_around_end()}, @_ |
|
|
0
|
|
|
|
|
0
|
|
|
182
|
|
|
|
|
|
|
} |
|
183
|
|
|
|
|
|
|
$self |
|
184
|
0
|
|
|
|
|
0
|
} |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=head2 mk_element |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Create element object in namespace of element. |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=cut |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
sub mk_element { |
|
193
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
194
|
0
|
|
|
|
|
0
|
my $name = shift; |
|
195
|
0
|
|
|
|
|
0
|
my %args = @_; |
|
196
|
0
|
|
0
|
|
|
0
|
$args{context} ||= $self->ns->sub_context(); |
|
197
|
0
|
|
|
|
|
0
|
my $elem = new XML::ExtOn::Element:: |
|
198
|
|
|
|
|
|
|
name => $name, |
|
199
|
|
|
|
|
|
|
%args; |
|
200
|
0
|
|
|
|
|
0
|
return $elem; |
|
201
|
|
|
|
|
|
|
} |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
sub set_prefix { |
|
204
|
3
|
|
|
3
|
0
|
3
|
my $self = shift; |
|
205
|
3
|
|
|
|
|
6
|
my $prefix = shift; |
|
206
|
3
|
50
|
|
|
|
8
|
if ( defined $prefix ) { |
|
207
|
0
|
|
|
|
|
0
|
$self->{__prefix} = $prefix; |
|
208
|
0
|
|
|
|
|
0
|
$self->set_ns_uri( $self->ns->get_uri($prefix) ); |
|
209
|
|
|
|
|
|
|
} |
|
210
|
3
|
|
|
|
|
13
|
$self->{__prefix}; |
|
211
|
|
|
|
|
|
|
} |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
sub ns { |
|
214
|
3
|
|
|
3
|
0
|
7
|
return $_[0]->_context; |
|
215
|
|
|
|
|
|
|
} |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=head2 add_namespace => , [ => , ... ] |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
Add Namespace mapping. return C<$self> |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
If C eq '', this namespace will then apply to all elements |
|
222
|
|
|
|
|
|
|
that have no prefix. |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
$elem->add_namespace( |
|
225
|
|
|
|
|
|
|
"myns" => 'http://example.com/myns', |
|
226
|
|
|
|
|
|
|
"myns_test", 'http://example.com/myns_test', |
|
227
|
|
|
|
|
|
|
''=>'http://example.com/new_default_namespace' |
|
228
|
|
|
|
|
|
|
); |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=cut |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
sub add_namespace { |
|
233
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
234
|
0
|
|
|
|
|
0
|
my ( $prefix, $ns_uri ) = @_; |
|
235
|
0
|
|
|
|
|
0
|
my $default1_uri = $self->ns->get_uri(''); |
|
236
|
0
|
|
|
|
|
0
|
$self->ns->declare_prefix(@_); |
|
237
|
0
|
|
|
|
|
0
|
my $default2_uri = $self->ns->get_uri(''); |
|
238
|
0
|
0
|
|
|
|
0
|
unless ( $default1_uri ne $default2_uri ) { |
|
239
|
0
|
0
|
|
|
|
0
|
$self->set_prefix('') unless $self->set_prefix; |
|
240
|
|
|
|
|
|
|
} |
|
241
|
|
|
|
|
|
|
$self |
|
242
|
0
|
|
|
|
|
0
|
} |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
sub set_ns_uri { |
|
245
|
3
|
|
|
3
|
0
|
110
|
my $self = shift; |
|
246
|
3
|
50
|
|
|
|
12
|
$self->{__ns_iri} = shift if @_; |
|
247
|
3
|
|
|
|
|
7
|
$self->{__ns_iri}; |
|
248
|
|
|
|
|
|
|
} |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
sub default_ns_uri { |
|
251
|
0
|
|
|
0
|
0
|
0
|
return $_[0]->ns->get_uri('') |
|
252
|
|
|
|
|
|
|
} |
|
253
|
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=head2 default_uri |
|
255
|
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
Return default I for Element scope. |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=cut |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
sub default_uri { |
|
261
|
0
|
|
|
0
|
1
|
0
|
$_[0]->ns->get_uri(''); |
|
262
|
|
|
|
|
|
|
} |
|
263
|
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
sub name { |
|
265
|
0
|
|
|
0
|
1
|
0
|
return $_[0]->_set_name(); |
|
266
|
|
|
|
|
|
|
} |
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
=head2 local_name |
|
269
|
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
Return localname of elemnt ( without prefix ) |
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
=cut |
|
273
|
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
sub local_name { |
|
275
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
276
|
0
|
|
|
|
|
0
|
return $self->_set_name(@_); |
|
277
|
|
|
|
|
|
|
} |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
# to_sax2 |
|
280
|
|
|
|
|
|
|
# |
|
281
|
|
|
|
|
|
|
# Export elemnt as SAX2 struct |
|
282
|
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
sub to_sax2 { |
|
284
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
285
|
0
|
0
|
|
|
|
0
|
my $res = { |
|
|
|
0
|
|
|
|
|
|
|
286
|
|
|
|
|
|
|
Prefix => $self->set_prefix, |
|
287
|
|
|
|
|
|
|
LocalName => $self->local_name, |
|
288
|
|
|
|
|
|
|
Attributes => $self->attributes->to_sax2, |
|
289
|
|
|
|
|
|
|
Name => $self->set_prefix |
|
290
|
|
|
|
|
|
|
? $self->set_prefix() . ":" . $self->local_name |
|
291
|
|
|
|
|
|
|
: $self->local_name, |
|
292
|
|
|
|
|
|
|
NamespaceURI => $self->set_prefix ? $self->set_ns_uri() : '', |
|
293
|
|
|
|
|
|
|
}; |
|
294
|
0
|
|
|
|
|
0
|
return $res; |
|
295
|
|
|
|
|
|
|
} |
|
296
|
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
=head2 attrs_by_prefix |
|
298
|
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
Return reference to hash of attributes for I. |
|
300
|
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=cut |
|
302
|
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
sub attrs_by_prefix { |
|
304
|
1
|
|
|
1
|
1
|
4
|
my $self = shift; |
|
305
|
1
|
|
|
|
|
3
|
return $self->attributes->by_prefix(@_); |
|
306
|
|
|
|
|
|
|
} |
|
307
|
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
=head2 attrs_by_prefix |
|
309
|
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
Return reference to hash of attributes for I. |
|
311
|
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
=cut |
|
313
|
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
sub attrs_by_ns_uri { |
|
315
|
1
|
|
|
1
|
0
|
6
|
my $self = shift; |
|
316
|
1
|
|
|
|
|
3
|
return $self->attributes->by_ns_uri(@_); |
|
317
|
|
|
|
|
|
|
} |
|
318
|
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=head2 attrs_by_name |
|
320
|
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
Return reference to hash of attributes by name. |
|
322
|
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
=cut |
|
324
|
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
sub attrs_by_name { |
|
326
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
327
|
0
|
|
|
|
|
|
return $self->attributes->by_name(@_); |
|
328
|
|
|
|
|
|
|
} |
|
329
|
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
=head2 skip_content |
|
331
|
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
Skip entry of element. Return $self |
|
333
|
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
=cut |
|
335
|
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
sub skip_content { |
|
337
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
338
|
0
|
0
|
|
|
|
|
return 1 if $self->is_skip_content; |
|
339
|
0
|
|
|
|
|
|
$self->is_skip_content(1); |
|
340
|
0
|
|
|
|
|
|
$self; |
|
341
|
|
|
|
|
|
|
} |
|
342
|
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
=head2 is_skip_content |
|
344
|
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
Return 1 - if element marked to skip content |
|
346
|
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
=cut |
|
348
|
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
sub is_skip_content { |
|
350
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
351
|
0
|
0
|
|
|
|
|
$self->_skip_content(@_) || 0 |
|
352
|
|
|
|
|
|
|
} |
|
353
|
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
=head2 delete_element, delete |
|
355
|
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
Delete start and close element from stream. return C<$self> |
|
357
|
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
=cut |
|
359
|
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
sub delete { |
|
361
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
362
|
0
|
|
|
|
|
|
return $self->delete_element; |
|
363
|
|
|
|
|
|
|
} |
|
364
|
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
sub delete_element { |
|
366
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
367
|
0
|
0
|
|
|
|
|
return 1 if $self->is_delete_element; |
|
368
|
0
|
|
|
|
|
|
$self->is_delete_element(1); |
|
369
|
0
|
|
|
|
|
|
$self; |
|
370
|
|
|
|
|
|
|
} |
|
371
|
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
=head2 is_delete_element |
|
373
|
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
Return 1 - if element marked to delete |
|
375
|
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
=cut |
|
377
|
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
sub is_delete_element { |
|
379
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
380
|
0
|
0
|
|
|
|
|
$self->_delete_element(@_) || 0 |
|
381
|
|
|
|
|
|
|
} |
|
382
|
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
1; |
|
384
|
|
|
|
|
|
|
__END__ |