-
- private String getResourceVersion(OperationResult getResponse)
- throws ParserConfigurationException, SAXException, IOException {
- String respData = getResponse.getResult();
-
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
- DocumentBuilder builder = factory.newDocumentBuilder();
- InputSource is = new InputSource(new StringReader(respData));
- Document doc = builder.parse(is);
-
- NodeList nodesList = doc.getDocumentElement().getChildNodes();
-
- // @formatter:off
- return IntStream.range(0, nodesList.getLength()).mapToObj(nodesList::item)
- .filter(childNode -> childNode.getNodeName().equals(RESOURCE_VERSION_PARAM))
- .findFirst()
- .map(Node::getTextContent)
- .orElse(null);
- // @formatter:on
- }