title: Memory-efficient XML manipulation in Java
body: <p>We are in the process of implementing a transactional system that has two backend components:</p>
  
  <ul>
  <li>Component A generates an initial XML response</li>
  <li>Component B modifies the initial response XML </li>
  </ul>
  
  <p>The resulting XML is sent back to the requestor. Since we are likely doing this under heavy load, I'd like to do this in a very CPU/memory efficient way. </p>
  
  <p>What is the best way to perform the above while keeping a tight leash on overall memory utilization?</p>
  
  <p>Specifically, is my best best to do a DOM parse, of the output of Component A and pass that to Component B to modify in memory? Is there a better way to do this using SAX which may be more memory efficient? Are there standard libraries that do this via SAX or DOM?</p>
  
  <p>Thanks for any insights.</p>
  
  <p>-Raj</p>