line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package XML::XPathScript::Processor::LibXML; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:YANICK'; |
3
|
|
|
|
|
|
|
$XML::XPathScript::Processor::LibXML::VERSION = '2.00'; |
4
|
23
|
|
|
23
|
|
135
|
use strict; |
|
23
|
|
|
|
|
38
|
|
|
23
|
|
|
|
|
605
|
|
5
|
23
|
|
|
23
|
|
94
|
use warnings; |
|
23
|
|
|
|
|
42
|
|
|
23
|
|
|
|
|
551
|
|
6
|
|
|
|
|
|
|
|
7
|
23
|
|
|
23
|
|
95
|
use base qw/ XML::XPathScript::Processor /; |
|
23
|
|
|
|
|
39
|
|
|
23
|
|
|
|
|
9586
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub get_namespace { |
10
|
1617
|
|
|
1617
|
0
|
3147
|
my $ns = $_[1]->getNamespaces(); |
11
|
1617
|
100
|
|
|
|
3442
|
return $ns ? $ns->getData() : () ; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub is_text_node { |
15
|
|
|
|
|
|
|
# little catch: XML::LibXML::Comment is a |
16
|
|
|
|
|
|
|
# XML::LibXML::Text |
17
|
1598
|
|
100
|
1598
|
1
|
8319
|
return $_[1]->isa('XML::LibXML::Text') |
18
|
|
|
|
|
|
|
&& !$_[1]->isa('XML::LibXML::Comment'); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
104
|
|
|
104
|
0
|
270
|
sub get_attributes { return $_[1]->attributes } |
22
|
12
|
|
|
12
|
0
|
74
|
sub get_text_content { return $_[1]->textContent } |
23
|
88
|
|
|
88
|
0
|
284
|
sub get_child_nodes { return $_[1]->childNodes } |
24
|
1617
|
|
|
1617
|
0
|
5397
|
sub get_node_name { return $_[1]->localname } |
25
|
198
|
|
|
198
|
0
|
986
|
sub get_qualified_name { return $_[1]->nodeName } |
26
|
6764
|
|
|
6764
|
1
|
22254
|
sub is_element_node { return $_[1]->isa( 'XML::LibXML::Element' ); } |
27
|
12
|
|
|
12
|
1
|
59
|
sub is_comment_node { return $_[1]->isa( 'XML::LibXML::Comment' ); } |
28
|
0
|
|
|
0
|
1
|
0
|
sub is_pi_node { return $_[1]->isa( 'XML::LibXML::PI' ); } |
29
|
2961
|
|
|
2961
|
1
|
13687
|
sub is_nodelist { return $_[1]->isa( 'XML::LibXML::NodeList' ); } |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub get_attribute { |
32
|
9
|
100
|
|
9
|
0
|
102
|
return $_[1]->isa( 'XML::LibXML::Namespace' ) |
33
|
|
|
|
|
|
|
? sprintf(q{ %s="%s"}, $_[1]->getName(), $_[1]->value()) |
34
|
|
|
|
|
|
|
: $_[1]->toString( 0, 1 ) |
35
|
|
|
|
|
|
|
; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub translate_node { |
39
|
3104
|
|
|
3104
|
0
|
5471
|
my ( $self, $node, $params ) = @_; |
40
|
3104
|
100
|
|
|
|
8049
|
$node = $node->documentElement if $node->isa( 'XML::LibXML::Document' ); |
41
|
3104
|
|
|
|
|
6511
|
return $self->SUPER::translate_node( $node, $params ); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |