/[webpac]/trunk2/xmlify.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk2/xmlify.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 337 - (show annotations)
Thu Jun 10 19:22:40 2004 UTC (15 years, 3 months ago) by dpavlin
File size: 389 byte(s)
new trunk for webpac v2

1 #
2 # small function that creates one xml tag
3 #
4
5 # Escape <, >, & and ", and to produce valid XML
6 my %escape = ('<'=>'&lt;', '>'=>'&gt;', '&'=>'&amp;', '"'=>'&quot;');
7 my $escape_re = join '|' => keys %escape;
8
9 sub xmlify {
10 my $tag = shift;
11 my $out;
12
13 $out .= " <$tag>";
14 foreach my $v (@_) {
15 $v =~ s/($escape_re)/$escape{$1}/g;
16 $out .= $v;
17 }
18 $out .= "</$tag>\n";
19 return $out;
20 }

Properties

Name Value
cvs2svn:cvs-rev 1.1

  ViewVC Help
Powered by ViewVC 1.1.26