| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# -*- tab-width: 4 -*- |
|
2
|
|
|
|
|
|
|
# ex: set tabstop=4: |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
XML::TinyXML::Node - Tinyxml Node object |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=over 4 |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use XML::TinyXML::Node; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$node = XML::TinyXML::Node->new("child", "somevalue", { attribute => "value" }); |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
$attr = $node->getAttribute("attribute"); |
|
17
|
|
|
|
|
|
|
or |
|
18
|
|
|
|
|
|
|
$attr = $node->getAttribute(1); # attribute at index 1 |
|
19
|
|
|
|
|
|
|
or |
|
20
|
|
|
|
|
|
|
@attrs = $node->getAttributes(); # returns all attributes in the node |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=back |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Node representation for the TinyXML API |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 INSTANCE VARIABLES |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=over 4 |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=item * _attr |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Reference to the underlying XmlNodeAttributePtr object (which is a binding to the XmlNode C structure) |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=back |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 METHODS |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=over 4 |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
package XML::TinyXML::NodeAttribute; |
|
45
|
|
|
|
|
|
|
|
|
46
|
4
|
|
|
4
|
|
21
|
use strict; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
140
|
|
|
47
|
4
|
|
|
4
|
|
39
|
use warnings; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
1432
|
|
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
our $VERSION = "0.34"; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=item new ($attr) |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Wrap the XmlNodeAttributePtr C structure exposing accessor to its members |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
|
56
|
|
|
|
|
|
|
sub new { |
|
57
|
30
|
|
|
30
|
1
|
41
|
my ($class, $attr) = @_; |
|
58
|
30
|
50
|
|
|
|
100
|
return undef unless(UNIVERSAL::isa($attr, "XmlNodeAttributePtr")); |
|
59
|
30
|
|
|
|
|
99
|
my $self = bless({ _attr => $attr }, $class); |
|
60
|
30
|
|
|
|
|
162
|
return $self; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item name ([$newName]) |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Get/Set the name of the attribute |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
|
68
|
|
|
|
|
|
|
sub name { |
|
69
|
30
|
|
|
30
|
1
|
1026
|
my ($self, $newName) = @_; |
|
70
|
30
|
50
|
|
|
|
207
|
return defined($newName) |
|
71
|
|
|
|
|
|
|
? $self->{_attr}->name($newName) |
|
72
|
|
|
|
|
|
|
: $self->{_attr}->name; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item value ([$newValue]) |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Get/Set the value of the attribute |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
|
80
|
|
|
|
|
|
|
sub value { |
|
81
|
12
|
|
|
12
|
1
|
495
|
my ($self, $newValue) = @_; |
|
82
|
12
|
50
|
|
|
|
87
|
return defined($newValue) |
|
83
|
|
|
|
|
|
|
? $self->{_attr}->value($newValue) |
|
84
|
|
|
|
|
|
|
: $self->{_attr}->value; |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item node (]) |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Get the XML::TinyXML::Node to which this attribute belongs |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |
|
92
|
|
|
|
|
|
|
sub node { |
|
93
|
21
|
|
|
21
|
1
|
30
|
my $self = shift; |
|
94
|
21
|
|
|
|
|
107
|
return XML::TinyXML::Node->new($self->{_attr}->node); |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=item path () |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Returns the unique path identifying this attribute |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
(can be used in xpath expressions) |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
|
104
|
|
|
|
|
|
|
sub path { |
|
105
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
106
|
0
|
|
|
|
|
0
|
return sprintf("%s/\@%s", $self->{_attr}->node->path, $self->name); |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item type () |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Returns the type of this node |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
(at the moment it will return always the string : "ATTRIBUTE" |
|
114
|
|
|
|
|
|
|
which can be used to distinguish attribute-nodes from xml-nodes |
|
115
|
|
|
|
|
|
|
in @sets returned by xpath selections) |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
|
118
|
|
|
|
|
|
|
sub type { |
|
119
|
11
|
|
|
11
|
1
|
43
|
return "ATTRIBUTE"; |
|
120
|
|
|
|
|
|
|
} |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
1; |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=back |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=over 4 |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
XML::TinyXML::Node XML::TinyXML |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=back |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 AUTHOR |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
xant, Exant@cpan.orgE |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Copyright (C) 2008-2010 by xant |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
143
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8.8 or, |
|
144
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=cut |