title: Maintain whitespace/line breaks when serializing via ASMX Web Service
body: <p>I'm doing some pre-processing of an XML document in a ASMX Webservice (Legacy .NET SOAP Service) for eventual use in a Silverlight front end.</p>
  
  <p>I'm processing that XML document into a POCO object for ease of use.  The object is defined as follows:</p>
  
  <pre><code>public class CACDocument : ITextDocument
  {
      #region Properties
      public string Title { get; set; }
      public string Text { get; set; }
      public List&lt;Code&gt; CodeList { get; set; }
      public XElement FormatedText { get; set; }
      #endregion
  
      #region Constructor
      public CACDocument()
      {
          CodeList = new List&lt;Code&gt;();
      }
      #endregion
  }
  </code></pre>
  
  <p>The Text property in that object contains basically formatted text (line breaks, white space, etc...).  The XML node that feeds that property looks like this:</p>
  
  <pre><code>&lt;text&gt;
     A TITLE FOLLOWED BY two line breaks
  
  
     Some text followed by a line break
  
     Some more text that might extend for a paragraph or two followed by more line breaks
  
     Still more text
  &lt;/text&gt;
  </code></pre>
  
  <p>All is fine and format is maintained as I would expect up unitl the Web Services serializes the data to be sent out to the front end.  I'm guessing that in an attempt to optimize bandwidth, the serialized object strips the extra whitespace and line breaks from the Text property before sending it out.  In this one particular instance, that formatting is important.  Is there a way to force the webservice to maintain this whitespace/line break formatting?</p>
  
  <p>I imagine that I code substitute some coding for the items in question, and then convert back on the front end, but that strikes me as a bit of a kludge.</p>