This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
One way is to use XSLT to transform the document. Read up on the TrAX API to learn how to use it. What you'll do is create an XSLT stylesheet the writes the original XML adding the extra element. Another way is to use the SAX API and implement your writing directly as you read. That may be a little more simple for you but it does not scale well as you need to add more elements change elements, or remove elements. XSLT was designed for changing XML and I'd suggest that if your needs tend to grow.
Holla at me...<br /><a href="http://codeforfun.wordpress.com" target="_blank" rel="nofollow">http://codeforfun.wordpress.com</a>