What is that code supposed to do, exactly?
All you have is a sequence of calls to String.Replace with the two parameters the same: so they will replace a substring with the same substring, and do nothing at all in practice.
For example, if I have the string
hello&there
and I do this:
XMLStr = "hello&there"
XMLStr = XMLStr.Replace("&", "&")
Then I end up with
hello&there
And the call to replace has done a total on nothing.
So what are you trying to do? Because if you are trying to do HTML enocding to replace tag with printable ones in a web page, then you would be better off using Server.HTMLEncode which will do the job for you...