XML namespace on child element
<p>I've got the following class structure:</p>

<pre><code>public class Child { ... }

[XmlRoot("parent", Namespace="parentNamespace")]
public class Parent
{
    [XmlElement(Namespace="childNamespace")]
    public Child Child { get; set; }
}
</code></pre>

<p>The I try to serialize it using namespaces:</p>

<pre><code>namespaces.Add(string.Empty, "parentNamespace");
namespaces.Add("c", "childNamespace");
</code></pre>

<p>And I got the child namespace declared in parent element:</p>

<pre><code>&lt;parent xmlns:c="childNamespace" xmlns="parentNamespace"&gt;
  &lt;c:Child ... /&gt;
&lt;/parent&gt;
</code></pre>

<p>But I want to move child namespace declaration to child element. Like this:</p>

<pre><code>&lt;parent xmlns="parentNamespace"&gt;
  &lt;c:Child ... xmlns:c="childNamespace"&gt;
&lt;/parent&gt;
</code></pre>

<p>How should I put XML attributes to do that?</p>