Программирование в 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("&amp;")); FindAndReplace(&sReturn, &string("="),&string("&#61;")); FindAndReplace(&sReturn, &string("<"),&string("&lt;")); FindAndReplace(&sReturn, &string(">"),&string("&gt;")); FindAndReplace(&sReturn, &string("'"),&string("&apos;")); FindAndReplace(&sReturn, &string("\""),&string("&quot;"));

return sReturn; }

Листинг 5.8. Function ValidateValue

Закрыть окно






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