common/tools/csvToSysDef.pl
changeset 959 94716c328941
parent 344 348670fc497a
child 974 50e351dfaafe
--- a/common/tools/csvToSysDef.pl	Wed Apr 07 14:03:14 2010 +0100
+++ b/common/tools/csvToSysDef.pl	Fri Apr 09 10:34:32 2010 +0100
@@ -153,7 +153,14 @@
 	$tagName =~ s{^main::}{};
 	if ($tagName eq "Characters")
 	{
-		print $tree->{Text};
+		if ($tree->{Text} =~ m{[<>&]})
+		{
+			print "<![CDATA[$tree->{Text}]]>";
+		}
+		else
+		{
+			print $tree->{Text};
+		}
 		return;
 	}
 	
@@ -172,7 +179,11 @@
 		}
 		keys %$tree)
 	{
-		print " $attr=\"$tree->{$attr}\"";
+		my $value_escaped = $tree->{$attr};
+		$value_escaped =~ s/&/&amp;/g;
+		$value_escaped =~ s/</&lt;/g;
+		$value_escaped =~ s/>/&gt;/g;
+		print " $attr=\"$value_escaped\"";
 	}
 
 	my $children = $tree->{Kids};