| 1 | |||||||||||||||||||||||||||||||||
| 2 | ### | ||||||||||||||||||||||||||||||||
| 3 | # XML::SAX::Writer - SAX2 XML Writer | ||||||||||||||||||||||||||||||||
| 4 | # Robin Berjon <robin@knowscape.com> | ||||||||||||||||||||||||||||||||
| 5 | # 26/11/2001 - v0.01 | ||||||||||||||||||||||||||||||||
| 6 | ### | ||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||
| 8 | package XML::SAX::Writer::XML; | ||||||||||||||||||||||||||||||||
| 9 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 10 | 4 | ▶ | use XML::NamespaceSupport qw(); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 11 | 4 | @XML::SAX::Writer::XML::ISA = qw(XML::SAX::Writer); | |||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||
| 14 | #,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,# | ||||||||||||||||||||||||||||||||
| 15 | #`,`, The SAX Handler `,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,# | ||||||||||||||||||||||||||||||||
| 16 | #```````````````````````````````````````````````````````````````````# | ||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||
| 18 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 19 | # start_document | ||||||||||||||||||||||||||||||||
| 20 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 21 | 28 | ▶ | sub start_document { | ||||||||||||||||||||||||||||||
|
Subroutine
start_document: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 22 | 28 | my $self = shift; | |||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||
| 24 | 28 | $self->setConverter; | |||||||||||||||||||||||||||||||
| 25 | 28 | $self->setEscaperRegex; | |||||||||||||||||||||||||||||||
| 26 | 28 | $self->setCommentEscaperRegex; | |||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||
| 28 | 28 | $self->{NSDecl} = []; | |||||||||||||||||||||||||||||||
| 29 | 28 | $self->{NSHelper} = XML::NamespaceSupport->new({ xmlns => 1, fatal_errors => 0 }); | |||||||||||||||||||||||||||||||
| 30 | 28 | $self->{NSHelper}->pushContext; | |||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||
| 32 | 28 | $self->setConsumer; | |||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||
| 34 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||
| 36 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 37 | # end_document | ||||||||||||||||||||||||||||||||
| 38 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 39 | 28 | ▶ | sub end_document { | ||||||||||||||||||||||||||||||
|
Subroutine
end_document: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 40 | 28 | my $self = shift; | |||||||||||||||||||||||||||||||
| 41 | # we may need to do a little more here | ||||||||||||||||||||||||||||||||
| 42 | 28 | $self->{NSHelper}->popContext; | |||||||||||||||||||||||||||||||
| 43 | return $self->{Consumer}->finalize | ||||||||||||||||||||||||||||||||
| 44 | 28 | ▶ | if $self->{Consumer}->can( 'finalize' ); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||
| 46 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||
| 48 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 49 | # start_element | ||||||||||||||||||||||||||||||||
| 50 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 51 | 30 | ▶ | sub start_element { | ||||||||||||||||||||||||||||||
|
Subroutine
start_element: called CC=18 SCAR=45.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 52 | 30 | my $self = shift; | |||||||||||||||||||||||||||||||
| 53 | 30 | my $data = shift; | |||||||||||||||||||||||||||||||
| 54 | 30 | $self->_output_element; | |||||||||||||||||||||||||||||||
| 55 | 30 | my $attr = $data->{Attributes}; | |||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||
| 57 | # fix the namespaces and prefixes of what we're receiving, in case | ||||||||||||||||||||||||||||||||
| 58 | # something is wrong | ||||||||||||||||||||||||||||||||
| 59 | 30 | ▶ | if ($data->{NamespaceURI}) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | my $uri = $self->{NSHelper}->getURI($data->{Prefix}) || ''; | ||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'NSHelper'}->getURI($data->{'Prefix'}) || ''
MC/DC0%0/1
$self->{'NSHelper'}->getURI($data->{'Prefix'}) || ''
$self->{'NSHelper'}->getURI($data->{'Prefix'})
Truth table0%0/2
A
A= $self->{'NSHelper'}->getURI($data->{'Prefix'})
| |||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | if ($uri ne $data->{NamespaceURI}) { # ns has precedence | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 62 | 0 | $data->{Prefix} = $self->{NSHelper}->getPrefix($data->{NamespaceURI}); # random, but correct | |||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | $data->{Name} = $data->{Prefix} ? "$data->{Prefix}:$data->{LocalName}" : "$data->{LocalName}"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||
| 66 | elsif ($data->{Prefix}) { # we can't have a prefix and no NS | ||||||||||||||||||||||||||||||||
| 67 | 0 | $data->{Name} = $data->{LocalName}; | |||||||||||||||||||||||||||||||
| 68 | 0 | $data->{Prefix} = ''; | |||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||
| 71 | # create a hash containing the attributes so that we can ensure there is | ||||||||||||||||||||||||||||||||
| 72 | # no duplication. Also, we check that ns are properly declared, that the | ||||||||||||||||||||||||||||||||
| 73 | # Name is good, etc... | ||||||||||||||||||||||||||||||||
| 74 | 30 | my %attr_hash; | |||||||||||||||||||||||||||||||
| 75 | 30 | for my $at (values %$attr) { | |||||||||||||||||||||||||||||||
| 76 | 6 | ▶ | next unless length $at->{Name}; # people have trouble with autovivification | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 77 | 6 | ▶ | if ($at->{NamespaceURI}) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 78 | 0 | my $uri = $self->{NSHelper}->getURI($at->{Prefix}); | |||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | warn "Well formed error: prefix '$at->{Prefix}' is not bound to any URI" unless defined $uri; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | if (defined $uri and $uri ne $at->{NamespaceURI}) { # ns has precedence | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $uri and $uri ne $at->{"NamespaceURI"}
MC/DC0%0/2
defined $uri and $uri ne $at->{"NamespaceURI"}
defined $uri
$uri ne $at->{"NamespaceURI"}
Truth table0%0/3
A and B
A= defined $uriB= $uri ne $at->{"NamespaceURI"}
| |||||||||||||||||||||||||||||||||
| 81 | 0 | $at->{Prefix} = $self->{NSHelper}->getPrefix($at->{NamespaceURI}); # random, but correct | |||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | $at->{Name} = $at->{Prefix} ? "$at->{Prefix}:$at->{LocalName}" : "$at->{LocalName}"; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||
| 85 | elsif ($at->{Prefix}) { # we can't have a prefix and no NS | ||||||||||||||||||||||||||||||||
| 86 | 0 | $at->{Name} = $at->{LocalName}; | |||||||||||||||||||||||||||||||
| 87 | 0 | $at->{Prefix} = ''; | |||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||
| 89 | 6 | $attr_hash{$at->{Name}} = $at->{Value}; | |||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||
| 92 | 30 | for my $nd (@{$self->{NSDecl}}) { | |||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | if ($nd->{Prefix}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 94 | 0 | $attr_hash{'xmlns:' . $nd->{Prefix}} = $nd->{NamespaceURI}; | |||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||
| 96 | else { | ||||||||||||||||||||||||||||||||
| 97 | 0 | $attr_hash{'xmlns'} = $nd->{NamespaceURI}; | |||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||
| 100 | 30 | $self->{NSDecl} = []; | |||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||
| 102 | # build a string from what we have, and buffer it | ||||||||||||||||||||||||||||||||
| 103 | 30 | ▶ | Carp::cluck "ouch!" unless defined $data->{Name}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 104 | 30 | my $el = '<' . $data->{Name}; | |||||||||||||||||||||||||||||||
| 105 | 30 | for my $k (keys %attr_hash) { | |||||||||||||||||||||||||||||||
| 106 | 6 | $el .= ' ' . $k . '=\'' . $self->escape($attr_hash{$k}) . '\''; | |||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||
| 109 | 30 | $self->{BufferElement} = $el; | |||||||||||||||||||||||||||||||
| 110 | 30 | $self->{NSHelper}->pushContext; | |||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||
| 112 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||
| 114 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 115 | # end_element | ||||||||||||||||||||||||||||||||
| 116 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 117 | 30 | ▶ | sub end_element { | ||||||||||||||||||||||||||||||
|
Subroutine
end_element: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 118 | 30 | my $self = shift; | |||||||||||||||||||||||||||||||
| 119 | 30 | my $data = shift; | |||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||
| 121 | 30 | my $el; | |||||||||||||||||||||||||||||||
| 122 | 30 | ▶ | if ($self->{BufferElement}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 123 | 21 | $el = $self->{BufferElement} . ' />'; | |||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||
| 125 | else { | ||||||||||||||||||||||||||||||||
| 126 | 9 | $el = '</' . $data->{Name} . '>'; | |||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||
| 128 | 30 | $el = $self->{Encoder}->convert($el); | |||||||||||||||||||||||||||||||
| 129 | 30 | $self->{Consumer}->output($el); | |||||||||||||||||||||||||||||||
| 130 | 30 | $self->{NSHelper}->popContext; | |||||||||||||||||||||||||||||||
| 131 | 30 | $self->{BufferElement} = ''; | |||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||
| 133 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||
| 135 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 136 | # characters | ||||||||||||||||||||||||||||||||
| 137 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 138 | 10 | ▶ | sub characters { | ||||||||||||||||||||||||||||||
|
Subroutine
characters: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 139 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||
| 140 | 10 | my $data = shift; | |||||||||||||||||||||||||||||||
| 141 | 10 | $self->_output_element; | |||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||
| 143 | 10 | my $char = $data->{Data}; | |||||||||||||||||||||||||||||||
| 144 | 10 | ▶ | if ($self->{InCDATA}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 145 | # we must scan for ]]> in the CDATA and escape it if it | ||||||||||||||||||||||||||||||||
| 146 | # is present by close--opening | ||||||||||||||||||||||||||||||||
| 147 | # we need to have buffer text in front of this... | ||||||||||||||||||||||||||||||||
| 148 | 0 | $char = join ']]>]]<<![CDATA[', split ']]>', $char; | |||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||
| 150 | else { | ||||||||||||||||||||||||||||||||
| 151 | 10 | $char = $self->escape($char); | |||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||
| 153 | 10 | $char = $self->{Encoder}->convert($char); | |||||||||||||||||||||||||||||||
| 154 | 10 | $self->{Consumer}->output($char); | |||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||
| 156 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||
| 158 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 159 | # start_prefix_mapping | ||||||||||||||||||||||||||||||||
| 160 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | sub start_prefix_mapping { | ||||||||||||||||||||||||||||||
|
Subroutine
start_prefix_mapping: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 162 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 163 | 0 | my $data = shift; | |||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||
| 165 | 0 | push @{$self->{NSDecl}}, $data; | |||||||||||||||||||||||||||||||
| 166 | 0 | $self->{NSHelper}->declarePrefix($data->{Prefix}, $data->{NamespaceURI}); | |||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||
| 168 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||
| 170 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 171 | # end_prefix_mapping | ||||||||||||||||||||||||||||||||
| 172 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | sub end_prefix_mapping {} | ||||||||||||||||||||||||||||||
|
Subroutine
end_prefix_mapping: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 174 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||
| 176 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 177 | # processing_instruction | ||||||||||||||||||||||||||||||||
| 178 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | sub processing_instruction { | ||||||||||||||||||||||||||||||
|
Subroutine
processing_instruction: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 180 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 181 | 0 | my $data = shift; | |||||||||||||||||||||||||||||||
| 182 | 0 | $self->_output_element; | |||||||||||||||||||||||||||||||
| 183 | 0 | $self->_output_dtd; | |||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||
| 185 | 0 | my $pi = "<?$data->{Target} $data->{Data}?>"; | |||||||||||||||||||||||||||||||
| 186 | 0 | $pi = $self->{Encoder}->convert($pi); | |||||||||||||||||||||||||||||||
| 187 | 0 | $self->{Consumer}->output($pi); | |||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||
| 189 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||
| 191 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 192 | # ignorable_whitespace | ||||||||||||||||||||||||||||||||
| 193 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | sub ignorable_whitespace { | ||||||||||||||||||||||||||||||
|
Subroutine
ignorable_whitespace: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 195 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 196 | 0 | my $data = shift; | |||||||||||||||||||||||||||||||
| 197 | 0 | $self->_output_element; | |||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||
| 199 | 0 | my $char = $data->{Data}; | |||||||||||||||||||||||||||||||
| 200 | 0 | $char = $self->escape($char); | |||||||||||||||||||||||||||||||
| 201 | 0 | $char = $self->{Encoder}->convert($char); | |||||||||||||||||||||||||||||||
| 202 | 0 | $self->{Consumer}->output($char); | |||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||
| 204 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||
| 206 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 207 | # skipped_entity | ||||||||||||||||||||||||||||||||
| 208 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | sub skipped_entity { | ||||||||||||||||||||||||||||||
|
Subroutine
skipped_entity: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 210 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 211 | 0 | my $data = shift; | |||||||||||||||||||||||||||||||
| 212 | 0 | $self->_output_element; | |||||||||||||||||||||||||||||||
| 213 | 0 | $self->_output_dtd; | |||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||
| 215 | 0 | my $ent; | |||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | if ($data->{Name} =~ m/^%/) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 217 | 0 | $ent = $data->{Name} . ';'; | |||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||
| 219 | else { | ||||||||||||||||||||||||||||||||
| 220 | 0 | $ent = '&' . $data->{Name} . ';'; | |||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||
| 223 | 0 | $ent = $self->{Encoder}->convert($ent); | |||||||||||||||||||||||||||||||
| 224 | 0 | $self->{Consumer}->output($ent); | |||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||
| 227 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||
| 229 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 230 | # notation_decl | ||||||||||||||||||||||||||||||||
| 231 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 232 | 0 | ▶ | sub notation_decl { | ||||||||||||||||||||||||||||||
|
Subroutine
notation_decl: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 233 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 234 | 0 | my $data = shift; | |||||||||||||||||||||||||||||||
| 235 | 0 | $self->_output_dtd; | |||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||
| 237 | # I think that param entities are normalized before this | ||||||||||||||||||||||||||||||||
| 238 | 0 | my $not = " <!NOTATION " . $data->{Name}; | |||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | if ($data->{PublicId} and $data->{SystemId}) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$data->{"PublicId"} and $data->{"SystemId"}
MC/DC0%0/2
$data->{"PublicId"} and $data->{"SystemId"}
$data->{"PublicId"}
$data->{"SystemId"}
Truth table0%0/3
A and B
A= $data->{"PublicId"}B= $data->{"SystemId"}
| |||||||||||||||||||||||||||||||||
| 240 | 0 | $not .= ' PUBLIC \'' . $self->escape($data->{PublicId}) . '\' \'' . $self->escape($data->{SystemId}) . '\''; | |||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||
| 242 | elsif ($data->{PublicId}) { | ||||||||||||||||||||||||||||||||
| 243 | 0 | $not .= ' PUBLIC \'' . $self->escape($data->{PublicId}) . '\''; | |||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||
| 245 | else { | ||||||||||||||||||||||||||||||||
| 246 | 0 | $not .= ' SYSTEM \'' . $self->escape($data->{SystemId}) . '\''; | |||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||
| 248 | 0 | $not .= " >\n"; | |||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||
| 250 | 0 | $not = $self->{Encoder}->convert($not); | |||||||||||||||||||||||||||||||
| 251 | 0 | $self->{Consumer}->output($not); | |||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||
| 253 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||
| 255 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 256 | # unparsed_entity_decl | ||||||||||||||||||||||||||||||||
| 257 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 258 | 0 | ▶ | sub unparsed_entity_decl { | ||||||||||||||||||||||||||||||
|
Subroutine
unparsed_entity_decl: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 259 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 260 | 0 | my $data = shift; | |||||||||||||||||||||||||||||||
| 261 | 0 | $self->_output_dtd; | |||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||
| 263 | # I think that param entities are normalized before this | ||||||||||||||||||||||||||||||||
| 264 | 0 | my $ent = " <!ENTITY " . $data->{Name}; | |||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | if ($data->{PublicId}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 266 | 0 | $ent .= ' PUBLIC \'' . $self->escape($data->{PublicId}) . '\' \'' . $self->escape($data->{SystemId}) . '\''; | |||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||
| 268 | else { | ||||||||||||||||||||||||||||||||
| 269 | 0 | $ent .= ' SYSTEM \'' . $self->escape($data->{SystemId}) . '\''; | |||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||
| 271 | 0 | $ent .= " NDATA $data->{Notation} >\n"; | |||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||
| 274 | 0 | $ent = $self->{Encoder}->convert($ent); | |||||||||||||||||||||||||||||||
| 275 | 0 | $self->{Consumer}->output($ent); | |||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||
| 277 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||
| 279 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 280 | # element_decl | ||||||||||||||||||||||||||||||||
| 281 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | sub element_decl { | ||||||||||||||||||||||||||||||
|
Subroutine
element_decl: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 283 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 284 | 0 | my $data = shift; | |||||||||||||||||||||||||||||||
| 285 | 0 | $self->_output_dtd; | |||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||
| 287 | # I think that param entities are normalized before this | ||||||||||||||||||||||||||||||||
| 288 | 0 | my $eld = " <!ELEMENT " . $data->{Name} . ' ' . $data->{Model} . " >\n"; | |||||||||||||||||||||||||||||||
| 289 | 0 | $eld = $self->{Encoder}->convert($eld); | |||||||||||||||||||||||||||||||
| 290 | 0 | $self->{Consumer}->output($eld); | |||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||
| 292 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||
| 294 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 295 | # attribute_decl | ||||||||||||||||||||||||||||||||
| 296 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 297 | 0 | ▶ | sub attribute_decl { | ||||||||||||||||||||||||||||||
|
Subroutine
attribute_decl: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 298 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 299 | 0 | my $data = shift; | |||||||||||||||||||||||||||||||
| 300 | 0 | $self->_output_dtd; | |||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||
| 302 | # I think that param entities are normalized before this | ||||||||||||||||||||||||||||||||
| 303 | 0 | my $atd = " <!ATTLIST " . $data->{eName} . ' ' . $data->{aName} . ' '; | |||||||||||||||||||||||||||||||
| 304 | 0 | $atd .= $data->{Type} . ' ' . $data->{ValueDefault} . ' '; | |||||||||||||||||||||||||||||||
| 305 | 0 | ▶ | $atd .= $data->{Value} . ' ' if $data->{Value}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 306 | 0 | $atd .= " >\n"; | |||||||||||||||||||||||||||||||
| 307 | 0 | $atd = $self->{Encoder}->convert($atd); | |||||||||||||||||||||||||||||||
| 308 | 0 | $self->{Consumer}->output($atd); | |||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||
| 310 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||
| 312 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 313 | # internal_entity_decl | ||||||||||||||||||||||||||||||||
| 314 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 315 | 0 | ▶ | sub internal_entity_decl { | ||||||||||||||||||||||||||||||
|
Subroutine
internal_entity_decl: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 316 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 317 | 0 | my $data = shift; | |||||||||||||||||||||||||||||||
| 318 | 0 | $self->_output_dtd; | |||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||
| 320 | # I think that param entities are normalized before this | ||||||||||||||||||||||||||||||||
| 321 | 0 | my $ent = " <!ENTITY " . $data->{Name} . ' \'' . $self->escape($data->{Value}) . "' >\n"; | |||||||||||||||||||||||||||||||
| 322 | 0 | $ent = $self->{Encoder}->convert($ent); | |||||||||||||||||||||||||||||||
| 323 | 0 | $self->{Consumer}->output($ent); | |||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||
| 325 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||
| 327 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 328 | # external_entity_decl | ||||||||||||||||||||||||||||||||
| 329 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 330 | 0 | ▶ | sub external_entity_decl { | ||||||||||||||||||||||||||||||
|
Subroutine
external_entity_decl: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 331 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 332 | 0 | my $data = shift; | |||||||||||||||||||||||||||||||
| 333 | 0 | $self->_output_dtd; | |||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||
| 335 | # I think that param entities are normalized before this | ||||||||||||||||||||||||||||||||
| 336 | 0 | my $ent = " <!ENTITY " . $data->{Name}; | |||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | if ($data->{PublicId}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 338 | 0 | $ent .= ' PUBLIC \'' . $self->escape($data->{PublicId}) . '\' \'' . $self->escape($data->{SystemId}) . '\''; | |||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||
| 340 | else { | ||||||||||||||||||||||||||||||||
| 341 | 0 | $ent .= ' SYSTEM \'' . $self->escape($data->{SystemId}) . '\''; | |||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||
| 343 | 0 | $ent .= " >\n"; | |||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||
| 346 | 0 | $ent = $self->{Encoder}->convert($ent); | |||||||||||||||||||||||||||||||
| 347 | 0 | $self->{Consumer}->output($ent); | |||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||
| 349 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||
| 351 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 352 | # comment | ||||||||||||||||||||||||||||||||
| 353 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 354 | 0 | ▶ | sub comment { | ||||||||||||||||||||||||||||||
|
Subroutine
comment: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 355 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 356 | 0 | my $data = shift; | |||||||||||||||||||||||||||||||
| 357 | 0 | $self->_output_element; | |||||||||||||||||||||||||||||||
| 358 | 0 | $self->_output_dtd; | |||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||
| 360 | 0 | my $cmt = '<!--' . $self->escapeComment($data->{Data}) . '-->'; | |||||||||||||||||||||||||||||||
| 361 | 0 | $cmt = $self->{Encoder}->convert($cmt); | |||||||||||||||||||||||||||||||
| 362 | 0 | $self->{Consumer}->output($cmt); | |||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||
| 364 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||
| 366 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 367 | # start_dtd | ||||||||||||||||||||||||||||||||
| 368 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 369 | 0 | ▶ | sub start_dtd { | ||||||||||||||||||||||||||||||
|
Subroutine
start_dtd: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 370 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 371 | 0 | my $data = shift; | |||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||
| 373 | 0 | my $dtd = '<!DOCTYPE ' . $data->{Name}; | |||||||||||||||||||||||||||||||
| 374 | 0 | ▶ | if ($data->{PublicId}) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 375 | 0 | $dtd .= ' PUBLIC \'' . $self->escape($data->{PublicId}) . '\' \'' . $self->escape($data->{SystemId}) . '\''; | |||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||
| 377 | elsif ($data->{SystemId}) { | ||||||||||||||||||||||||||||||||
| 378 | 0 | $dtd .= ' SYSTEM \'' . $self->escape($data->{SystemId}) . '\''; | |||||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||
| 381 | 0 | $self->{BufferDTD} = $dtd; | |||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||
| 383 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||
| 385 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 386 | # end_dtd | ||||||||||||||||||||||||||||||||
| 387 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | sub end_dtd { | ||||||||||||||||||||||||||||||
|
Subroutine
end_dtd: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 389 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 390 | 0 | my $data = shift; | |||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||
| 392 | 0 | my $dtd; | |||||||||||||||||||||||||||||||
| 393 | 0 | ▶ | if ($self->{BufferDTD}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 394 | 0 | $dtd = $self->{BufferDTD} . ' >'; | |||||||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||||||
| 396 | else { | ||||||||||||||||||||||||||||||||
| 397 | 0 | $dtd = ' ]>'; | |||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||
| 399 | 0 | $dtd = $self->{Encoder}->convert($dtd); | |||||||||||||||||||||||||||||||
| 400 | 0 | $self->{Consumer}->output($dtd); | |||||||||||||||||||||||||||||||
| 401 | 0 | $self->{BufferDTD} = ''; | |||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||
| 403 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||
| 405 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 406 | # start_cdata | ||||||||||||||||||||||||||||||||
| 407 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 408 | 0 | ▶ | sub start_cdata { | ||||||||||||||||||||||||||||||
|
Subroutine
start_cdata: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 409 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 410 | 0 | $self->_output_element; | |||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||
| 412 | 0 | $self->{InCDATA} = 1; | |||||||||||||||||||||||||||||||
| 413 | 0 | my $cds = $self->{Encoder}->convert('<![CDATA['); | |||||||||||||||||||||||||||||||
| 414 | 0 | $self->{Consumer}->output($cds); | |||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||
| 416 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||
| 418 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 419 | # end_cdata | ||||||||||||||||||||||||||||||||
| 420 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 421 | 0 | ▶ | sub end_cdata { | ||||||||||||||||||||||||||||||
|
Subroutine
end_cdata: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 422 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||
| 424 | 0 | $self->{InCDATA} = 0; | |||||||||||||||||||||||||||||||
| 425 | 0 | my $cds = $self->{Encoder}->convert(']]>'); | |||||||||||||||||||||||||||||||
| 426 | 0 | $self->{Consumer}->output($cds); | |||||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||||||
| 428 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||
| 430 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 431 | # start_entity | ||||||||||||||||||||||||||||||||
| 432 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 433 | 0 | ▶ | sub start_entity { | ||||||||||||||||||||||||||||||
|
Subroutine
start_entity: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 434 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 435 | 0 | my $data = shift; | |||||||||||||||||||||||||||||||
| 436 | 0 | $self->_output_element; | |||||||||||||||||||||||||||||||
| 437 | 0 | $self->_output_dtd; | |||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||
| 439 | 0 | my $ent; | |||||||||||||||||||||||||||||||
| 440 | 0 | ▶ | if ($data->{Name} eq '[dtd]') { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||
| 441 | # we ignore the fact that we're dealing with an external | ||||||||||||||||||||||||||||||||
| 442 | # DTD entity here, and prolly shouldn't write the DTD | ||||||||||||||||||||||||||||||||
| 443 | # events unless explicitly told to | ||||||||||||||||||||||||||||||||
| 444 | # this will prolly change | ||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||
| 446 | elsif ($data->{Name} =~ m/^%/) { | ||||||||||||||||||||||||||||||||
| 447 | 0 | $ent = $data->{Name} . ';'; | |||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||
| 449 | else { | ||||||||||||||||||||||||||||||||
| 450 | 0 | $ent = '&' . $data->{Name} . ';'; | |||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||
| 453 | 0 | $ent = $self->{Encoder}->convert($ent); | |||||||||||||||||||||||||||||||
| 454 | 0 | $self->{Consumer}->output($ent); | |||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||
| 456 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||
| 458 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 459 | # end_entity | ||||||||||||||||||||||||||||||||
| 460 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 461 | 0 | ▶ | sub end_entity { | ||||||||||||||||||||||||||||||
|
Subroutine
end_entity: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 462 | # depending on what is done above, we might need to do sth here | ||||||||||||||||||||||||||||||||
| 463 | } | ||||||||||||||||||||||||||||||||
| 464 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||
| 467 | ### SAX1 stuff ###################################################### | ||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||
| 469 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 470 | # xml_decl | ||||||||||||||||||||||||||||||||
| 471 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 472 | 0 | ▶ | sub xml_decl { | ||||||||||||||||||||||||||||||
|
Subroutine
xml_decl: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 473 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 474 | 0 | my $data = shift; | |||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||
| 476 | # version info is compulsory, contrary to what some seem to think | ||||||||||||||||||||||||||||||||
| 477 | # also, there's order in the pseudo-attr | ||||||||||||||||||||||||||||||||
| 478 | 0 | my $xd = ''; | |||||||||||||||||||||||||||||||
| 479 | 0 | ▶ | if ($data->{Version}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 480 | 0 | $xd .= "<?xml version='$data->{Version}'"; | |||||||||||||||||||||||||||||||
| 481 | 0 | ▶ | if ($data->{Encoding}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 482 | 0 | $xd .= " encoding='$data->{Encoding}'"; | |||||||||||||||||||||||||||||||
| 483 | } | ||||||||||||||||||||||||||||||||
| 484 | 0 | ▶ | if ($data->{Standalone}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 485 | 0 | $xd .= " standalone='$data->{Standalone}'"; | |||||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||||||
| 487 | 0 | $xd .= '?>'; | |||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||
| 490 | 0 | $xd = $self->{Encoder}->convert($xd); # this may blow up | |||||||||||||||||||||||||||||||
| 491 | 0 | $self->{Consumer}->output($xd); | |||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||
| 493 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||
| 496 | #,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,# | ||||||||||||||||||||||||||||||||
| 497 | #`,`, Helpers `,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,# | ||||||||||||||||||||||||||||||||
| 498 | #```````````````````````````````````````````````````````````````````# | ||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||
| 500 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 501 | # _output_element | ||||||||||||||||||||||||||||||||
| 502 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 503 | 40 | ▶ | sub _output_element { | ||||||||||||||||||||||||||||||
|
Subroutine
_output_element: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 504 | 40 | my $self = shift; | |||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||
| 506 | 40 | ▶ | if ($self->{BufferElement}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 507 | 9 | my $el = $self->{BufferElement} . '>'; | |||||||||||||||||||||||||||||||
| 508 | 9 | $el = $self->{Encoder}->convert($el); | |||||||||||||||||||||||||||||||
| 509 | 9 | $self->{Consumer}->output($el); | |||||||||||||||||||||||||||||||
| 510 | 9 | $self->{BufferElement} = ''; | |||||||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||||||
| 513 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||
| 515 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 516 | # _output_dtd | ||||||||||||||||||||||||||||||||
| 517 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 518 | 0 | ▶ | sub _output_dtd { | ||||||||||||||||||||||||||||||
|
Subroutine
_output_dtd: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||
| 519 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||
| 521 | 0 | ▶ | if ($self->{BufferDTD}) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 522 | 0 | my $dtd = $self->{BufferDTD} . " [\n"; | |||||||||||||||||||||||||||||||
| 523 | 0 | $dtd = $self->{Encoder}->convert($dtd); | |||||||||||||||||||||||||||||||
| 524 | 0 | $self->{Consumer}->output($dtd); | |||||||||||||||||||||||||||||||
| 525 | 0 | $self->{BufferDTD} = ''; | |||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||
| 527 | } | ||||||||||||||||||||||||||||||||
| 528 | #-------------------------------------------------------------------# | ||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||
| 530 | 4 | 1; | |||||||||||||||||||||||||||||||
| 531 | #,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,# | ||||||||||||||||||||||||||||||||
| 532 | #`,`, Documentation `,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,# | ||||||||||||||||||||||||||||||||
| 533 | #```````````````````````````````````````````````````````````````````# | ||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||
| 535 | =pod | ||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||
| 537 | =head1 NAME | ||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||
| 539 | XML::SAX::Writer::XML - SAX2 XML Writer | ||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||
| 541 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||
| 543 | ... | ||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||
| 545 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||
| 547 | ... | ||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||
| 549 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||
| 551 | Robin Berjon, robin@knowscape.com | ||||||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||||||
| 553 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||
| 555 | Copyright (c) 2001-2002 Robin Berjon. All rights reserved. This program is | ||||||||||||||||||||||||||||||||
| 556 | free software; you can redistribute it and/or modify it under the same | ||||||||||||||||||||||||||||||||
| 557 | terms as Perl itself. | ||||||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||||||
| 559 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||
| 561 | XML::SAX::* | ||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||
| 563 | =cut | ||||||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||||||