title: Remove Element from JDOM document using removeContent()
body: <p>Given the following scenario, where the xml, Geography.xml looks like -   </p>
  
  <pre><code>&lt;Geography xmlns:ns="some valid namespace"&gt;
      &lt;Country&gt;
          &lt;Region&gt;
              &lt;State&gt;
                  &lt;City&gt;
                      &lt;Name&gt;&lt;/Name&gt;
                      &lt;Population&gt;&lt;/Population&gt;
                  &lt;/City&gt;
              &lt;/State&gt;
              &lt;/Region&gt;
          &lt;/Country&gt;
      &lt;/Geography&gt;
  </code></pre>
  
  <p>and the following sample java code -  </p>
  
  <pre><code>InputStream is = new FileInputStream("C:\\Geography.xml");
  SAXBuilder saxBuilder = new SAXBuilder();
  Document doc = saxBuilder.build(is);
  
  XPath xpath = XPath.newInstance("/*/Country/Region/State/City");
  Element el = (Element) xpath.selectSingleNode(doc);
  boolean b = doc.removeContent(el);
  </code></pre>
  
  <p>The <code>removeContent()</code> method doesn't remove the Element <code>City</code> from the content list of the <code>doc</code>. The value of b is <code>false</code><br>
  I don't understand why is it not removing the Element, I even tried to delete the <code>Name</code> &amp; <code>Population</code> elements from the xml just to see if that was the issue but apparently its not.<br>
  Another way I tried, I don't know why I know its not essentially different, still just for the sake, was to use <code>Parent</code> -  </p>
  
  <pre><code>Parent p = el.getParent();
  boolean s = p.removeContent(new Element("City"));
  </code></pre>
  
  <p>What might the problem? and a possible solution? and if anyone can share the real behaviour of the method <code>removeContent()</code>, I suspect it has to do with the parent-child relationship.  </p>