This file is indexed.

/usr/lib/perl5/XML/LibXML/NodeList.pm is in libxml-libxml-perl 1.89+dfsg-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# $Id$
#
# This is free software, you may use it and distribute it under the same terms as
# Perl itself.
#
# Copyright 2001-2003 AxKit.com Ltd., 2002-2006 Christian Glahn, 2006-2009 Petr Pajas
#
#

package XML::LibXML::NodeList;

use strict;
use warnings;

use XML::LibXML::Boolean;
use XML::LibXML::Literal;
use XML::LibXML::Number;

use vars qw($VERSION);
$VERSION = "1.89"; # VERSION TEMPLATE: DO NOT CHANGE

use overload 
        '""' => \&to_literal,
        'bool' => \&to_boolean,
        'cmp' => sub {
            my($aa, $bb, $order) = @_;
            return ($order ? ("$bb" cmp "$aa") : ("$aa" cmp "$bb"));
        },
        ;

sub new {
    my $class = shift;
    bless [@_], $class;
}

sub new_from_ref {
    my ($class,$array_ref,$reuse) = @_;
    return bless $reuse ? $array_ref : [@$array_ref], $class;
}

sub pop {
    my $self = CORE::shift;
    CORE::pop @$self;
}

sub push {
    my $self = CORE::shift;
    CORE::push @$self, @_;
}

sub append {
    my $self = CORE::shift;
    my ($nodelist) = @_;
    CORE::push @$self, $nodelist->get_nodelist;
}

sub shift {
    my $self = CORE::shift;
    CORE::shift @$self;
}

sub unshift {
    my $self = CORE::shift;
    CORE::unshift @$self, @_;
}

sub prepend {
    my $self = CORE::shift;
    my ($nodelist) = @_;
    CORE::unshift @$self, $nodelist->get_nodelist;
}

sub size {
    my $self = CORE::shift;
    scalar @$self;
}

sub get_node {
    # uses array index starting at 1, not 0
    # this is mainly because of XPath.
    my $self = CORE::shift;
    my ($pos) = @_;
    $self->[$pos - 1];
}

*item = \&get_node;

sub get_nodelist {
    my $self = CORE::shift;
    @$self;
}

sub to_boolean {
    my $self = CORE::shift;
    return (@$self > 0) ? XML::LibXML::Boolean->True : XML::LibXML::Boolean->False;
}

# string-value of a nodelist is the string-value of the first node
sub string_value {
    my $self = CORE::shift;
    return '' unless @$self;
    return $self->[0]->string_value;
}

sub to_literal {
    my $self = CORE::shift;
    return XML::LibXML::Literal->new(
            join('', grep {defined $_} map { $_->string_value } @$self)
            );
}

sub to_number {
    my $self = CORE::shift;
    return XML::LibXML::Number->new(
            $self->to_literal
            );
}

sub iterator {
    warn "this function is obsolete!\nIt was disabled in version 1.54\n";
    return undef;
}

1;
__END__

=head1 NAME

XML::LibXML::NodeList - a list of XML document nodes

=head1 DESCRIPTION

An XML::LibXML::NodeList object contains an ordered list of nodes, as
detailed by the W3C DOM documentation of Node Lists.

=head1 SYNOPSIS

  my $results = $dom->findnodes('//somepath');
  foreach my $context ($results->get_nodelist) {
    my $newresults = $context->findnodes('./other/element');
    ...
  }

=head1 API

=head2 new()

You will almost never have to create a new NodeList object, as it is all
done for you by XPath.

=head2 get_nodelist()

Returns a list of nodes, the contents of the node list, as a perl list.

=head2 string_value()

Returns the string-value of the first node in the list.
See the XPath specification for what "string-value" means.

=head2 to_literal()

Returns the concatenation of all the string-values of all
the nodes in the list.

=head2 get_node($pos)

Returns the node at $pos. The node position in XPath is based at 1, not 0.

=head2 size()

Returns the number of nodes in the NodeList.

=head2 pop()

Equivalent to perl's pop function.

=head2 push(@nodes)

Equivalent to perl's push function.

=head2 append($nodelist)

Given a nodelist, appends the list of nodes in $nodelist to the end of the
current list.

=head2 shift()

Equivalent to perl's shift function.

=head2 unshift(@nodes)

Equivalent to perl's unshift function.

=head2 prepend($nodelist)

Given a nodelist, prepends the list of nodes in $nodelist to the front of
the current list.

=cut