title: Linq to Xml and Namespace prefixes
body: <p>I am working with Linq to Xml to manipulate openXml documents.  More precisely I am trying to read and write to the documents custom properties.  I am currently having a problem appending a prefix onto an XElement.  My code looks like:</p>
  
  <pre><code>Dim main as XNameSpace = "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
  
  Dim vt as XNameSpace = "http://schemas.openxmlformats.org/officeDocument2006/docPropsVTypes"
  
  Dim props as XElement = cXDoc.Element(main + "Properties"
          props.Add(New XElement(main + "property"), _
                                 New XAttribute("fmtid", formatId), _
                                 New XAttribute("pid", pid + 1), _
                                 New XAttribute("name", "test"), _
                                      New XElement(vt + "lpwstr", "test value")) _
                   )
  </code></pre>
  
  <p>The Xml contained in props before the add is :</p>
  
  <pre><code>&lt;Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes" /&gt;
  </code></pre>
  
  <p>The Xml after the props.add method() call is:</p>
  
  <pre><code>   &lt;Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"&gt;
    &lt;property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="2" name="test"&gt;
      &lt;lpwstr xmlns="http://schemas.openxmlformats.org/officeDocument2006/docPropsVTypes"&gt;test value&lt;/lpwstr&gt;
    &lt;/property&gt;
  &lt;/Properties&gt;
  </code></pre>
  
  <p>Within the property element I should be getting </p>
  
  <pre><code>&lt;vt:lpwstr&gt;test value&lt;/vt:lpwstr&gt; 
  </code></pre>
  
  <p>but just can't get this to happen.  I don't want the xmlns attribute for this element here either.  I think I somehow need to get the map the vt XNameSpace back to the namespace declaration in the root element "Properties".  Does anyone have any suggestions?</p>