Reputation: 83
I'm trying to pull the version value (2.100.2) where href="someclient.jar" using JAVA. Any suggesstions? I've gotten up to parsing the xml file into a Document.
<?xml version="1.0" encoding="utf-8"?>
<jnlp>
<resources>
<jar href="someclient.jar" version="2.100.2" />
<jar href="cisco-upgrade.jar" version="1.5" />
<jar href="collections.jar" version="1.1" />
<jar href="commons-codec.jar" version="1.4" />
<jar href="commons-email.jar" version="1.1" />
</resources>
</jnlp>
Java:
File fileXML = new File(path);
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(fileXML);
Upvotes: 0
Views: 40
Reputation: 3456
Use XPath
String expression = "/jnlp/resources/jar[@href='someclient.jar']/@version";
Upvotes: 3