| Revision 755 (by dpavlin, 2006/10/29 16:42:48) |
|---|
#
# small function that creates one xml tag
#
# Escape <, >, & and ", and to produce valid XML
my %escape = ('<'=>'<', '>'=>'>', '&'=>'&', '"'=>'"');
my $escape_re = join '|' => keys %escape;
sub xmlify {
my $tag = shift;
my $out;
$out .= " <$tag>";
foreach my $v (@_) {
$v =~ s/($escape_re)/$escape{$1}/g;
$out .= $v;
}
$out .= "</$tag>\n";
return $out;
}