Pretty easy using the default document classes provided by the JDK. I would prefer to use XPath on this particular item because it is easy to adapt to changes in the DOM.
First parse your document and place in a org.w3c.dom.Document class
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = builder.parse(new File("path to your file"));
Then I would create my XPath object that will get the version number to the item I want to change. This XPath query will find the version node where a sibling node named files value is set to cisco-upgrade_v1_5.jar.
XPath xPath = XPathFactory.newInstance().newXPath();
Node ciscoVersion = (Node)xPath.evaluate("/jnlp/resource/pattern/version-id[../file='cisco-upgrade_v1_5.jar']",
document.getDocumentElement(),
XPathConstants.NODE);
Set the new version number
ciscoVersion.setTextContent("1.5.2");
So now we have the version number changed for the cisco-upgrade_v1_5.jar entry we can output our result
TransformerFactory tranFactory = TransformerFactory.newInstance();
Transformer aTransformer = tranFactory.newTransformer();
Source src = new DOMSource(document);
Result dest = new StreamResult(new FileOutputStream(new File("path to your file")));
aTransformer.transform(src, dest);
For convenience here is a list of imports you will need to implement this
import java.io.File;
import java.io.FileOutputStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Node;