private String encodeValue(String value)
  {
    StringBuilder builder = new StringBuilder();
    int i;
    for(i = 0; i < value.length(); i++)
    {
      char c = value.charAt(i);
      switch(c)
      {
        case '"':
          builder.append("\\\"");
          break;
        case '\\':
          builder.append("\\\\");
          break;
        default:
          builder.append(c);  
      }
    }    
    return builder.toString();
  }