List of utility methods to do XPath Get
String | getORSVersion() get ORS Version String version = null; try { String curDir = System.getProperty("user.dir"); Path pomFile = Paths.get(Paths.get(curDir).getParent().toString(), "openrouteservice") .resolve("pom.xml"); try (InputStream is = Files.newInputStream(pomFile)) { Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(is); doc.getDocumentElement().normalize(); ... |
String | getProcessIdFromBpmn(final String bpmn) get Process Id From Bpmn String processId = null; try { final DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); domFactory.setNamespaceAware(true); final Document doc = domFactory.newDocumentBuilder() .parse(new ByteArrayInputStream(bpmn.getBytes("UTF-8"))); final XPath xpath = XPathFactory.newInstance().newXPath(); xpath.setNamespaceContext(new NamespaceContext() { ... |
PublicKey | getPublicKeyFromKeyInfo(Node keyInfoNode) get Public Key From Key Info PublicKey publicKey = null; try { String modulusString = keyModulusPath.evaluate(keyInfoNode); String exponentString = keyExponentPath.evaluate(keyInfoNode); if (modulusString == null || exponentString == null) { return null; byte[] modulusBytes = Base64.decodeBase64(modulusString); ... |
String | getResultXpathstring(String expr, InputSource inputSource) get Result Xpathstring XPathExpression xExpr = xPath.compile(expr);
return xExpr.evaluate(inputSource);
|
Map | getScrProperties(String componentName) get Scr Properties return getScrProperties(String.format("target/classes/OSGI-INF/%s.xml", componentName), componentName); |
Node | getSearchHandlerNode(final File solrconfig) Get the searchHandler Node from the solrconfig.xml file final DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); final DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); final Document docSchem = dBuilder.parse(solrconfig); final XPathFactory xPathfactory = XPathFactory.newInstance(); final XPath xpath = xPathfactory.newXPath(); final XPathExpression expr = xpath .compile("//requestHandler[@class=\"solr.SearchHandler\" and @name=\"/select\"]"); final Node requestHandler = (Node) expr.evaluate(docSchem, XPathConstants.NODE); ... |
XPath | getSharedXPath() get Shared X Path XPath xPath = null; if (sharedXPath != null) xPath = sharedXPath.get(); if (xPath == null) { XPathFactory xPathFactory = XPathFactory.newInstance(); sharedXPath = new SoftReference<XPath>(xPath = xPathFactory.newXPath()); return xPath; ... |
String | getSpeficValueFromNode(Node n, String xpathExpr) get Spefic Value From Node XPath xpath = XPathFactory.newInstance().newXPath();
xpath.setNamespaceContext(ihcNamespaceContext);
XPathExpression pathExpr = xpath.compile(xpathExpr);
return (String) pathExpr.evaluate(n, XPathConstants.STRING);
|
String | getStrFromNode(Node xpathnode) Method getStrFromNode if (xpathnode.getNodeType() == Node.TEXT_NODE) { StringBuilder sb = new StringBuilder(); for (Node currentSibling = xpathnode.getParentNode() .getFirstChild(); currentSibling != null; currentSibling = currentSibling.getNextSibling()) { if (currentSibling.getNodeType() == Node.TEXT_NODE) { sb.append(((Text) currentSibling).getData()); return sb.toString(); } else if (xpathnode.getNodeType() == Node.ATTRIBUTE_NODE) { return ((Attr) xpathnode).getNodeValue(); } else if (xpathnode.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) { return ((ProcessingInstruction) xpathnode).getNodeValue(); return null; |
String | getStrFromNode(Node xpathnode) Method getStrFromNode if (xpathnode.getNodeType() == Node.TEXT_NODE) { StringBuilder sb = new StringBuilder(); for (Node currentSibling = xpathnode.getParentNode() .getFirstChild(); currentSibling != null; currentSibling = currentSibling.getNextSibling()) { if (currentSibling.getNodeType() == Node.TEXT_NODE) { sb.append(((Text) currentSibling).getData()); return sb.toString(); } else if (xpathnode.getNodeType() == Node.ATTRIBUTE_NODE) { return xpathnode.getNodeValue(); } else if (xpathnode.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) { return xpathnode.getNodeValue(); return null; |