I'm doing some pre-processing of an XML document in a .NET Webservice (Standard .NET SOAP Service) for eventual use in a Silverlight front end.
I'm processing that XML document into a POCO object for ease of use. The object is defined as follows:
public class CACDocument : ITextDocument
{
#region Properties
public string Title { get; set; }
public string Text { get; set; }
public List<Code> CodeList { get; set; }
public XElement FormatedText { get; set; }
#endregion
#region Constructor
public CACDocument()
{
CodeList = new List<Code>();
}
#endregion
}
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:
<text>
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
</text>
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?
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 cludge.
Thanks in advance