I have some XML text that I wish to render in an HTML page. This text contains an ampersand, which I want to render in its entity representation: &.
&
In my case I had to change it to %26.
%26
I needed to escape & in a URL. So & did not work out for me. The urlencode function changes & to %26. This way neither XML nor the browser URL mechanism complained about the URL.