AFAIK the only characters required escape sequences for tag content are &
, <
and >
. Thus XElement produces valid XML.
If your code requires this escape to persist it's, probably, not very good, since it's requires non-standard behaviour.
But if you wish to preserve exact content you can use a CDATA section.
As for your comment, I guess it's not possible to use CDATA if you not in control of incoming XML. Possibly you only option then is to either process XML as a text file, or to replace '
to '
(and other escape sequences) after XML modification, after converting it to a string.