Added XML escaping, so that the output should be well-formed XML even if the input includes '<'s, '>'s, or '&'s.
authorSimon Howkins <simonh@symbian.org>
Mon, 05 Oct 2009 11:33:00 +0100
changeset 580 0a42a7ed6d8d
parent 579 78b42fd9e2c4
child 581 46df4556c7d9
child 582 2b1ac4e5e2e8
Added XML escaping, so that the output should be well-formed XML even if the input includes '<'s, '>'s, or '&'s.
common/tools/brag/logToBRAG.pl
--- a/common/tools/brag/logToBRAG.pl	Mon Oct 05 11:22:09 2009 +0100
+++ b/common/tools/brag/logToBRAG.pl	Mon Oct 05 11:33:00 2009 +0100
@@ -133,7 +133,7 @@
 	$tagName =~ s{^main::}{};
 	if ($tagName eq "Characters")
 	{
-		print $tree->{Text};
+		print escapeForXML($tree->{Text});
 		return;
 	}
 	
@@ -173,3 +173,11 @@
 	print ">";
 }
 
+sub escapeForXML
+{
+	$_ = shift;
+	s{&}{&amp;}g;
+	s{<}{&lt;}g;
+	s{>}{&gt;}g;
+	return $_;
+}