title: XML fix namespace declaration
body: <p>I am trying to detetct/work around <a href="http://validator.w3.org/feed/docs/error/MediaRssNamespace.html" rel="nofollow noreferrer">this</a> bug in RSS elements.
  That means I have to find a wrong namespace-declaration and change its
  value to the correct namespace. E.g:</p>
  
  <pre><code>xmlns:media="http://search.yahoo.com/mrss" 
  </code></pre>
  
  <p>must be:</p>
  
  <pre><code>xmlns:media="http://search.yahoo.com/mrss/" 
  </code></pre>
  
  <p>How can I achive that given a org.w3c.Document?</p>
  
  <p>I meanwile found out how to get all elements of a certain namespace:</p>
  
  <pre><code>        XPathFactory xpf = XPathFactory.newInstance();
          XPath xpath = xpf.newXPath();
          XPathExpression expr = xpath.compile("//*[namespace-uri()='http://search.yahoo.com/mrss']");
  
  
          Object result = expr.evaluate(d, XPathConstants.NODESET);
          if (result != null) {
              NodeList nodes = (NodeList) result;
              for(int node=0;node&lt;nodes.getLength();node++)
              {
                  Node n = nodes.item(node);
                  this.log.warn("Found old mediaRSS namespace declaration: "+n.getTextContent());
              }
  
          } 
  </code></pre>
  
  <p>So now I have to figure out how to change the namespace of a Node via JAXP.</p>