&inString, const std::string &oldToken, const std::string &newToken) { std::string result = inString; size_t foundLoc; int advance = 0; do { foundLoc = result.find(oldToken, advance); if (foundLoc != std::string::npos){ result.replace(foundLoc, oldToken.length(), newToken); advance = foundLoc + newToken.length(); } } while (foundLoc != std::string::npos ); return result; } static std::string myXmlTokenReplace(const char *inString){ std::string myString(inString); myString = myStringReplace( myStringReplace( myStringReplace( myStringReplace( myStringReplace(myString, "&", "&" ), "<", "<" ), "\"", """ ), "'", "'" ), ">", ">" ) ; return myString; }