line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package XML::XPath::Helper::Const;
|
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
255056
|
use 5.010;
|
|
2
|
|
|
|
|
20
|
|
4
|
2
|
|
|
2
|
|
12
|
use strict;
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
39
|
|
5
|
2
|
|
|
2
|
|
10
|
use warnings;
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
60
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
12
|
use Exporter 'import';
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
63
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
669
|
use XML::LibXML;
|
|
2
|
|
|
|
|
50861
|
|
|
2
|
|
|
|
|
11
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.03';
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our @EXPORT_OK = qw(XPATH_SIMPLE_LIST
|
14
|
|
|
|
|
|
|
XPATH_SIMPLE_TAGS
|
15
|
|
|
|
|
|
|
XPATH_NESTED_TAGS);
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our %EXPORT_TAGS = (all => \@EXPORT_OK);
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
use constant
|
20
|
|
|
|
|
|
|
{
|
21
|
|
|
|
|
|
|
# The following is taken from:
|
22
|
|
|
|
|
|
|
# https://stackoverflow.com/questions/75059177/is-it-possible-to-find-nodes-containing-a-simple-list-using-xpath-1-0/75061420#75061420
|
23
|
2
|
|
|
|
|
285
|
XPATH_SIMPLE_LIST => XML::LibXML::XPathExpression->new(<<"EOT"),
|
24
|
|
|
|
|
|
|
./*[
|
25
|
|
|
|
|
|
|
*[not(*)]
|
26
|
|
|
|
|
|
|
and
|
27
|
|
|
|
|
|
|
not(*[position()>1
|
28
|
|
|
|
|
|
|
and
|
29
|
|
|
|
|
|
|
name(.) != name(preceding-sibling::*[1])])
|
30
|
|
|
|
|
|
|
]
|
31
|
|
|
|
|
|
|
EOT
|
32
|
|
|
|
|
|
|
XPATH_SIMPLE_TAGS => XML::LibXML::XPathExpression->new("*[count(*) = 0]"),
|
33
|
|
|
|
|
|
|
XPATH_NESTED_TAGS => XML::LibXML::XPathExpression->new("*[count(*) > 0]"),
|
34
|
2
|
|
|
2
|
|
460
|
};
|
|
2
|
|
|
|
|
13
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; # End of XML::XPath::Helper::Const
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__
|