* /trunk/vg
[gpstools.git] / GPSTxml.pm
blob6e732d8d93924868f1e9de3dd979b4734fae6ad4
1 package GPSTxml;
3 #=======================================================================
4 # $Id$
5 # File ID: 7065d156-fafa-11dd-a242-000475e441b9
7 # Character set: UTF-8
8 # ©opyleft 2002– Øyvind A. Holm <sunny@sunbase.org>
9 # License: GNU General Public License, see end of file for legal stuff.
10 #=======================================================================
12 use strict;
13 use warnings;
15 BEGIN {
16 use Exporter ();
17 our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
19 my $rcs_id = '$Id$';
20 push(@main::version_array, $rcs_id);
21 $VERSION = ($rcs_id =~ / (\d+) /, $1);
23 @ISA = qw(Exporter);
24 @EXPORT = qw(&txt_to_xml &xml_to_txt);
25 %EXPORT_TAGS = ();
27 our @EXPORT_OK;
29 sub txt_to_xml {
30 # Convert plain text to XML {{{
31 my $Txt = shift;
32 $Txt =~ s/&/&amp;/gs;
33 $Txt =~ s/</&lt;/gs;
34 $Txt =~ s/>/&gt;/gs;
35 return($Txt);
36 # }}}
39 sub xml_to_txt {
40 # Convert XML data to plain text {{{
41 my $Txt = shift;
42 $Txt =~ s/&lt;/</gs;
43 $Txt =~ s/&gt;/>/gs;
44 $Txt =~ s/&amp;/&/gs;
45 $Txt =~ s/&quot;/"/gs;
46 $Txt =~ s/&apos;/'/gs;
47 return($Txt);
48 # }}}