protected static void EscapeAndAppendString(StringBuilder buffer, string text, params char[] specialChars)
{
// add the root identifier.
if (text != null)
{
for (int ii = 0; ii < text.Length; ii++)
{
char ch = text[ii];
// escape any special characters.
for (int jj = 0; jj < specialChars.Length; jj++)
{
if (specialChars[jj] == ch)
{
buffer.Append(specialChars[0]);
}
}
buffer.Append(ch);
}
}
}