title: add node to a node XML dom4j
body: <p>In DOM4J and XML how to add a node to an existing node?</p>
  
  <p>If I follow the example its very easy and works great if I have an element already.</p>
  
  <pre><code>Element root = doc.getRootElement();
  Element someElement = root.addElement("some");
  Element anotherElement = someElement.addElement("another");
  </code></pre>
  
  <p>and so forth. Easy if I have an Element object.</p>
  
  <p>but once I lose a reference or am loading an xml and not creating one from scratch I just can't wrap my head around how I add a node /element exactly where I want. </p>
  
  <p>So the specific question is: Given a document and an specific element in it, how do I add an element underneath it? Do I have to iterate through the whole document? Xpath I can only get to return nodes which have no .addElement and I can't turn it into an element. Im simply stumped and aside from adding an ID=? to every single node I just cant figure out how to put something exactly where I want it to go. Any help or direction would be greatly appreciated.</p>