title: How can I append an attribute to an existing XML element in Java?
body: <p>I want to append an attribute an existing element in XML using Java. For example:</p>
  
  <pre><code>&lt;employee&gt;
  &lt;details name="Jai" age="25"/&gt;
  &lt;details name="kishore" age="30"/&gt;
  &lt;/employee&gt;
  </code></pre>
  
  <p>It want to add <code>weight</code> to it (assume that it is calculated and then appended in response). How can I append that to all items?</p>
  
  <pre><code>&lt;details name="Jai" age="25" weight="55"/&gt;
  </code></pre>