changeset 580 | 0a42a7ed6d8d |
parent 579 | 78b42fd9e2c4 |
child 753 | 5069de517698 |
579:78b42fd9e2c4 | 580:0a42a7ed6d8d |
---|---|
131 |
131 |
132 my $tagName = ref $tree; |
132 my $tagName = ref $tree; |
133 $tagName =~ s{^main::}{}; |
133 $tagName =~ s{^main::}{}; |
134 if ($tagName eq "Characters") |
134 if ($tagName eq "Characters") |
135 { |
135 { |
136 print $tree->{Text}; |
136 print escapeForXML($tree->{Text}); |
137 return; |
137 return; |
138 } |
138 } |
139 |
139 |
140 print "<$tagName"; |
140 print "<$tagName"; |
141 |
141 |
171 } |
171 } |
172 |
172 |
173 print ">"; |
173 print ">"; |
174 } |
174 } |
175 |
175 |
176 sub escapeForXML |
|
177 { |
|
178 $_ = shift; |
|
179 s{&}{&}g; |
|
180 s{<}{<}g; |
|
181 s{>}{>}g; |
|
182 return $_; |
|
183 } |