private static VersionIdentifier parseVersionString(final InputStream xml) throws ParserConfigurationException, IOException, SAXException, XPathExpressionException {
  final DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
  final DocumentBuilder builder=factory.newDocumentBuilder();
  final Document doc=builder.parse(xml);
  final XPathFactory xPathfactory=XPathFactory.newInstance();
  final XPath xpath=xPathfactory.newXPath();
  final XPathExpression expr=xpath.compile("/metadata/versioning/versions/version");
  return VersionRetriever.parseNodeList((NodeList)expr.evaluate(doc,XPathConstants.NODESET));
}

private static VersionIdentifier parseVersionString ( final InputStream xml ) throws ParserConfigurationException , IOException , SAXException , XPathExpressionException { final DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; final DocumentBuilder builder = factory . newDocumentBuilder ( ) ; final Document doc = builder . parse ( xml ) ; final XPathFactory xPathfactory = XPathFactory . newInstance ( ) ; final XPath xpath = xPathfactory . newXPath ( ) ; final XPathExpression expr = xpath . compile ( "/metadata/versioning/versions/version" ) ; return VersionRetriever . parseNodeList ( ( NodeList ) expr . evaluate ( doc , XPathConstants . NODESET ) ) ; }
parse xml using xpath and retrieve the version string .
