title: How to control Wcf REST XmlSerialization output
body: <p>I am trying to control the Xml output during a Wcf Rest serialisation process. I want to lose a tier in the output hierarchy. (I.e. lose the <code>&lt;content&gt;</code> tags). I have looked through the various attribute settings available, but not managed to find what I'm looking for. Can anyone help?</p>
  
  <hr>
  
  <p>My output is currently:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;ContentStructure xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"` xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
    &lt;content&gt;
      &lt;content_item id="{BED36077-DECE-4FCA-BE8F-D6D450B6CC08}"&gt;
        &lt;title&gt;&lt;![CDATA[Content Title 1]]&gt;&lt;/title&gt;
      &lt;/content_item&gt;
      &lt;content_item id="{BED36077-DECE-4FCA-BE8F-D6D450B6CC08}"&gt;
        &lt;title&gt;&lt;![CDATA[Content Title 1]]&gt;&lt;/title&gt;
      &lt;/content_item&gt;
      &lt;content_item id="{BED36077-DECE-4FCA-BE8F-D6D450B6CC08}"&gt;
        &lt;title&gt;&lt;![CDATA[Content Title 1]]&gt;&lt;/title&gt;
      &lt;/content_item&gt;
    &lt;/content&gt;
  &lt;/ContentStructure&gt;
  </code></pre>
  
  <p>What I am trying to get is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;ContentStructure xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
    &lt;content_item id="{BED36077-DECE-4FCA-BE8F-D6D450B6CC08}"&gt;
      &lt;title&gt;&lt;![CDATA[Content Title 1]]&gt;&lt;/title&gt;
    &lt;/content_item&gt;
    &lt;content_item id="{BED36077-DECE-4FCA-BE8F-D6D450B6CC08}"&gt;
      &lt;title&gt;&lt;![CDATA[Content Title 1]]&gt;&lt;/title&gt;
    &lt;/content_item&gt;
    &lt;content_item id="{BED36077-DECE-4FCA-BE8F-D6D450B6CC08}"&gt;
      &lt;title&gt;&lt;![CDATA[Content Title 1]]&gt;&lt;/title&gt;
    &lt;/content_item&gt;
  &lt;/ContentStructure&gt;
  </code></pre>
  
  <hr>
  
  <p>My class structure is as follows:</p>
  
  <pre><code>[DataContract(Namespace = "")]  
  public class ContentStructure  
  {  
      [DataMember(Order = 0)]  
      [XmlArrayItem(ElementName = "content_item")]  
      public List&lt;ContentItem&gt; content { get; set; }  
  }  
  </code></pre>
  
  <p>Where <code>ContentItem</code> contains a set of fields.</p>
  
  <p>My wcf service is defined as:</p>
  
  <pre><code>[WebHelp(Comment = "Returns content xml")]
  [WebGet(UriTemplate = "/Content/Gallery", ResponseFormat = WebMessageFormat.Xml)]
  [OperationContract(Name = "GetContent")]
  [XmlSerializerFormat]
  public ContentStructure GetContent()
  {
      return ServiceProvider.GetContent();
  }
  </code></pre>
  
  <p>My contract is:</p>
  
  <pre><code>public interface IServiceProvider
  {
      ContentStructure GetContent();
  }
  </code></pre>
  
  <p>Which is implemented as:</p>
  
  <pre><code>public class ServiceProvider : IServiceProvider
  {
      public ContentStructure GetContent()
      {
          return GetContentItems(CONTENT_ROOT);
      }
  }
  </code></pre>
  
  <p>Thanks in advance.</p>