Программирование в IIS




Пример 5.8


/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Name: ValidateValue

In: Constant reference to a string variable sValue. sValue is the

value being checked to see if it has a character requiring

escaping

Out: returns a string with the escaped characters in place

Purpose:

blindly replaces all special characters

with the escape sequence character so that XML will

be valid.

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

string ValidateValue(const string &sValue)

{

string sReturn;

sReturn = sValue;

FindAndReplace(&sReturn, &string("&"),&string("&"));

FindAndReplace(&sReturn, &string("="),&string("="));

FindAndReplace(&sReturn, &string("<"),&string("<"));

FindAndReplace(&sReturn, &string(">"),&string(">"));

FindAndReplace(&sReturn, &string("'"),&string("'"));

FindAndReplace(&sReturn, &string("\""),&string("""));

return sReturn;

}




Содержание  Назад  Вперед