title: Set namespace using jdom
body: <p>I would like have this format in xml: </p>
  
  <pre><code>&lt;ns2: test xmlns="url" xmlns:ns2="url2" xmlns:ns3="url3"&gt;
  ....
  &lt;/ns2: test&gt;
  </code></pre>
  
  <p>I am using the following code:</p>
  
  <pre><code>    Namespace ns= Namespace.getNamespace("url");
      Namespace ns2 = Namespace.getNamespace("ns2", "url2");
      Namespace ns3= Namespace.getNamespace("ns3", "url3");
  
      SAXBuilder vDocBuilder = new SAXBuilder();
      Document vDocument = vDocBuilder.build(File);
  
      System.out.println("Root element " + vDocument.getRootElement().getName());
  
      org.jdom.Element test = new org.jdom.Element("test", ns);
      vDocument.setRootElement(test);
      vNewRootElement.addNamespaceDeclaration(ns2);
      vNewRootElement.addNamespaceDeclaration(ns3);
  </code></pre>
  
  <p>If I set namespace with:</p>
  
  <pre><code>    vNewRootElement.setNamespace(ns3);
  </code></pre>
  
  <p>Then I get thi:s</p>
  
  <pre><code>    &lt;ns2: test xmlns:ns2="url2" xmlns:ns3="url3"&gt; ... &lt;/ns2: test&gt; 
  without the default namespace xmlns="url".
  </code></pre>
  
  <p>Can anybody tell me why it dosen't work and is there a way to solve this problem?</p>
  
  <p>Thanks, haner</p>