@Override public ArrayList<String> getUsersfromXpath(ArrayOfXPathExpressionType xpaths, String message) { ArrayList<String> userlist = new ArrayList<String>(); if (xpaths == null || xpaths.getXPathExpressionType() == null || xpaths.getXPathExpressionType().isEmpty()) { return new ArrayList<String>(); } try { InputStream is = new ByteArrayInputStream(message.getBytes(Constants.CHARSET)); Document xmlDocument = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(is); for (int i = 0; i < xpaths.getXPathExpressionType().size(); i++) { XPath xpath = XPathFactory.newInstance().newXPath(); javax.xml.xpath.XPathExpression xp = xpath.compile(xpaths.getXPathExpressionType().get(i).getXPath()); String t2 = (String) xp.evaluate(xmlDocument, XPathConstants.STRING); if (!Utility.stringIsNullOrEmpty(t2)) { userlist.add(t2); } } } catch (Exception ex) { log.log(Level.WARN, "Error evaluating xpath expression for consumer identification", ex); } return userlist; }