I'm porting a set of services to .Net 4.0 and have discovered (much to my dismay) that character entities I'm creating and storing in XElement.Value()'s are being "restored" to their original character values when I convert the XDocument object into an XML stream for the HTTP response.
The "escaped" characters need to appear in the XML document as character entities (e.g. ®
and not ®) to remain compatible with legacy applications that were written to only allow character entities for non-Latin characters.
Is there a way (a different document type, or Encoding() method, or something else altogether) I can configure XDocument to preserve these character entities when I create my XML stream? Maybe there's an alternative to XDocument or XmlDocument that I can use instead?