Beispiel #1
0
 private string UnEscape(string theInput)
 {
     Scanner scan = new Scanner(theInput);
     StringBuilder result = new StringBuilder();
     while (true) {
         scan.FindTokenPair("&", ";");
         result.Append(scan.Leader);
         if (scan.Body.Length == 0) break;
         if (scan.Body.Equals("lt")) result.Append('<');
         else if (scan.Body.Equals("gt")) result.Append('>');
         else if (scan.Body.Equals("amp")) result.Append('&');
         else if (scan.Body.Equals("nbsp")) result.Append(' ');
         else if (scan.Body.Equals("quot")) result.Append('"');
         else {
             result.Append('&');
             result.Append(scan.Body);
             result.Append(';');
         }
     }
     return result.ToString();
 }
Beispiel #2
0
 private string UnFormat(string theInput)
 {
     TextOutput result = new TextOutput();
     Scanner scan = new Scanner(theInput);
     while (true) {
         scan.FindTokenPair("<", ">", ourValidTagFilter);
         result.Append(scan.Leader);
         if (scan.Body.Length == 0) break;
         if (FitVersionFixture.IsStandard) result.AppendTag(GetTag(scan.Body));
     }
     return result.ToString();
 }