line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# Copyright (C) 1998 Ken MacLeod |
3
|
|
|
|
|
|
|
# XML::Grove is free software; you can redistribute it and/or |
4
|
|
|
|
|
|
|
# modify it under the same terms as Perl itself. |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# $Id: Grove.pm,v 1.15 1999/08/17 15:01:28 kmacleod Exp $ |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
2216
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
85
|
|
10
|
2
|
|
|
2
|
|
64
|
use 5.005; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
77
|
|
11
|
2
|
|
|
2
|
|
3397
|
use UNIVERSAL; |
|
2
|
|
|
|
|
51
|
|
|
2
|
|
|
|
|
12
|
|
12
|
2
|
|
|
2
|
|
5254
|
use Data::Grove; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
package XML::Grove; |
15
|
|
|
|
|
|
|
use vars qw{$VERSION @ISA}; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$VERSION = '0.46alpha'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
@ISA = qw{Data::Grove}; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
package XML::Grove::Document; |
22
|
|
|
|
|
|
|
use vars qw{@ISA $type_name}; |
23
|
|
|
|
|
|
|
@ISA = qw{XML::Grove}; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
$type_name = 'document'; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Override methods that may be loaded from Data::Grove::Parent. In |
28
|
|
|
|
|
|
|
# XML::Grove, `root' and `rootpath' refer to the root _element_ of the |
29
|
|
|
|
|
|
|
# grove, not the document that contains it. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# Note: this routine specifically sets $value and does last instead of |
32
|
|
|
|
|
|
|
# returning $child immediately because there is a bug in Perl 5.005 that |
33
|
|
|
|
|
|
|
# causes the returned value to disappear |
34
|
|
|
|
|
|
|
sub root { |
35
|
|
|
|
|
|
|
my $self = shift; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
if (@_) { |
38
|
|
|
|
|
|
|
return $self->{Contents} = [ shift ]; |
39
|
|
|
|
|
|
|
} else { |
40
|
|
|
|
|
|
|
my $value = undef; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
foreach my $child (@{$self->{Contents}}) { |
43
|
|
|
|
|
|
|
if ($child->isa('XML::Grove::Element')) { |
44
|
|
|
|
|
|
|
$value = $child; |
45
|
|
|
|
|
|
|
last; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
return $value; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub rootpath { |
54
|
|
|
|
|
|
|
return; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
package XML::Grove::Element; |
58
|
|
|
|
|
|
|
use vars qw{ @ISA $type_name }; |
59
|
|
|
|
|
|
|
@ISA = qw{XML::Grove}; |
60
|
|
|
|
|
|
|
$type_name = 'element'; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
package XML::Grove::PI; |
63
|
|
|
|
|
|
|
use vars qw{ @ISA $type_name }; |
64
|
|
|
|
|
|
|
@ISA = qw{XML::Grove}; |
65
|
|
|
|
|
|
|
$type_name = 'pi'; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
package XML::Grove::Entity::External; |
68
|
|
|
|
|
|
|
use vars qw{ @ISA $type_name }; |
69
|
|
|
|
|
|
|
@ISA = qw{XML::Grove}; |
70
|
|
|
|
|
|
|
$type_name = 'external_entity'; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
package XML::Grove::Entity::SubDoc; |
73
|
|
|
|
|
|
|
use vars qw{ @ISA $type_name }; |
74
|
|
|
|
|
|
|
@ISA = qw{XML::Grove}; |
75
|
|
|
|
|
|
|
$type_name = 'subdoc_entity'; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
package XML::Grove::Entity::SGML; |
78
|
|
|
|
|
|
|
use vars qw{ @ISA $type_name }; |
79
|
|
|
|
|
|
|
@ISA = qw{XML::Grove}; |
80
|
|
|
|
|
|
|
$type_name = 'sgml_entity'; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
package XML::Grove::Entity; |
83
|
|
|
|
|
|
|
use vars qw{ @ISA $type_name }; |
84
|
|
|
|
|
|
|
@ISA = qw{XML::Grove}; |
85
|
|
|
|
|
|
|
$type_name = 'entity'; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
package XML::Grove::Notation; |
88
|
|
|
|
|
|
|
use vars qw{ @ISA $type_name }; |
89
|
|
|
|
|
|
|
@ISA = qw{XML::Grove}; |
90
|
|
|
|
|
|
|
$type_name = 'notation'; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
package XML::Grove::Comment; |
93
|
|
|
|
|
|
|
use vars qw{ @ISA $type_name }; |
94
|
|
|
|
|
|
|
@ISA = qw{XML::Grove}; |
95
|
|
|
|
|
|
|
$type_name = 'comment'; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
package XML::Grove::SubDoc; |
98
|
|
|
|
|
|
|
use vars qw{ @ISA $type_name }; |
99
|
|
|
|
|
|
|
@ISA = qw{XML::Grove}; |
100
|
|
|
|
|
|
|
$type_name = 'subdoc'; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
package XML::Grove::Characters; |
103
|
|
|
|
|
|
|
use vars qw{ @ISA $type_name }; |
104
|
|
|
|
|
|
|
@ISA = qw{XML::Grove}; |
105
|
|
|
|
|
|
|
$type_name = 'characters'; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
package XML::Grove::CData; |
108
|
|
|
|
|
|
|
use vars qw{ @ISA $type_name }; |
109
|
|
|
|
|
|
|
@ISA = qw{XML::Grove}; |
110
|
|
|
|
|
|
|
$type_name = 'cdata'; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
package XML::Grove::ElementDecl; |
113
|
|
|
|
|
|
|
use vars qw{ @ISA $type_name }; |
114
|
|
|
|
|
|
|
@ISA = qw{XML::Grove}; |
115
|
|
|
|
|
|
|
$type_name = 'element_decl'; |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
package XML::Grove::AttListDecl; |
118
|
|
|
|
|
|
|
use vars qw{ @ISA $type_name }; |
119
|
|
|
|
|
|
|
@ISA = qw{XML::Grove}; |
120
|
|
|
|
|
|
|
$type_name = 'attlist_decl'; |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
1; |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
__END__ |