this.propertyType = PropertyType.Normal;
this.parentProject = parentProject;
this.name = propertyElement.Name;
- this.value = propertyElement.InnerXml;
+ this.value = Utilities.UnescapeFromXml (propertyElement.InnerXml);
this.isImported = false;
}
+2009-08-26 Ankit Jain <jankit@novell.com>
+
+ * Utilities.cs (UnescapeFromXml): New. From md.
+ * BuildProperty.cs (.ctor): Unescape xml codes from the InnerXml
+ of the property element.
+
2009-08-26 Ankit Jain <jankit@novell.com>
* BuildProperty.cs (ConvertToString): New.
// Author:
// Marek Sieradzki (marek.sieradzki@gmail.com)
// Lluis Sanchez Gual <lluis@novell.com>
+// Michael Hutchinson <mhutchinson@novell.com>
//
// (C) 2005 Marek Sieradzki
// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
return sb.ToString ();
}
+ internal static string UnescapeFromXml (string text)
+ {
+ StringBuilder sb = new StringBuilder ();
+ for (int i = 0; i < text.Length; i++) {
+ char c1 = text[i];
+ if (c1 == '&') {
+ int end = text.IndexOf (';', i);
+ if (end == -1)
+ throw new FormatException ("Unterminated XML entity.");
+ string entity = text.Substring (i+1, end - i - 1);
+ switch (entity) {
+ case "lt":
+ sb.Append ('<');
+ break;
+ case "gt":
+ sb.Append ('>');
+ break;
+ case "amp":
+ sb.Append ('&');
+ break;
+ case "apos":
+ sb.Append ('\'');
+ break;
+ case "quot":
+ sb.Append ('"');
+ break;
+ default:
+ throw new FormatException ("Unrecogised XML entity '&" + entity + ";'.");
+ }
+ i = end;
+ } else
+ sb.Append (c1);
+ }
+ return sb.ToString ();
+ }
+
+
internal static string FromMSBuildPath (string relPath)
{
if (relPath == null || relPath.Length == 0)