private String getLastPathComponentType(String path) throws XPathExpressionException { Node node = helper.xpathAsNode(path + "/attribute::type"); if (node == null) return ""; return node.getNodeValue(); }