encount DOMException when remove node
<p>i encount DOMException.HIERARCHY_REQUEST_ERR when navigate the Document object to remove a pecific node, and after google this error code, It says:</p>

<p>"HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the newChild node, or if the node to insert is one of this node's ancestors or this node itself, or if this node is of type Document and the DOM application attempts to insert a second DocumentType or Element node"</p>

<p>I have check the node type which i want to remove, both Element and Text type will cause the exception</p>

<p>here is my code</p>

<pre><code>        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        Document dom = builder.parse(new ByteArrayInputStream(smil.getBytes()));

        Element root = dom.getDocumentElement();

        Node node = root.getFirstChild();
        dom.removeChild(node);
</code></pre>

<p>it goes </p>

<p>"org.w3c.dom.DOMException</p>

<p>at org.apache.harmony.xml.dom.InnerNodeImpl.removeChild(InnerNodeImpl.java:180)"</p>

<p>does any one has the same problem ?</p>

<p>thank you :-)</p>
