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