List of utility methods to do XPath Create
XPathFactory | getXPathFactory() get X Path Factory return XPathFactory.newInstance();
|
XPathFactory | getXPathFactory() get X Path Factory if (_xPathFactory == null) { String magicValue = System .getProperty("javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom"); System.setProperty("javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom", "net.sf.saxon.xpath.XPathFactoryImpl"); _xPathFactory = XPathFactory.newInstance(XPathConstants.DOM_OBJECT_MODEL); if (magicValue == null) System.clearProperty("javax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom"); ... |
XPathFactory | getXPathFactory() get X Path Factory return XPATH_FACTORY.get();
|
XPathFactory | getXPathFactory() Gets the XPath factory, creating it if necessary. if (xpathFactory == null) { xpathFactory = XPathFactory.newInstance(); return xpathFactory; |
XPathFilterParameterSpec | getXpathFilter(String xpath, Map get Xpath Filter XPathFilterParameterSpec params = namespaceMap == null ? new XPathFilterParameterSpec(xpath) : new XPathFilterParameterSpec(xpath, namespaceMap); return params; |
String | getXPathForElement(Node e, NamespaceContext ctx) get X Path For Element StringBuffer sb = new StringBuffer(); List<Node> path = new ArrayList<Node>(); Node currentNode = e; while (currentNode.getParentNode() != currentNode.getOwnerDocument()) { path.add(0, currentNode); if (currentNode instanceof Attr) { Attr a = (Attr) currentNode; currentNode = a.getOwnerElement(); ... |
String | getXPathForNode(Node node) Does a reverse walking of the DOM tree to generate a unique XPath expression leading to this node. final StringBuilder sb = new StringBuilder(); Node parent = node; while (parent != null && parent.getNodeType() != Node.DOCUMENT_NODE) { sb.insert(0, "]"); sb.insert(0, getIndexInParent(parent) + 1); sb.insert(0, "["); sb.insert(0, parent.getNodeName()); sb.insert(0, "/"); ... |
String | getXPathForNode(Node node) Does a reverse walking of the DOM tree to generate a unique XPath expression leading to this node. String index = ""; if (node.getNodeType() == Node.ELEMENT_NODE) { int successors = 1; Node previous = node.getPreviousSibling(); while (null != previous) { if (previous.getNodeType() == Node.ELEMENT_NODE && previous.getNodeName().equals(node.getNodeName())) { successors++; ... |
String | getXPathFromVector(Vector path) get X Path From Vector StringBuffer strBuf = new StringBuffer(); int length = path.size(); for (int i = 0; i < length; i++) { Node tempNode = (Node) path.elementAt(i); short nodeType = getNodeType(tempNode); String targetValue = getValue(tempNode, nodeType); int position = 1; tempNode = getPreviousTypedNode(tempNode, nodeType); ... |
String | getXPathFromVector(Vector path) get X Path From Vector StringBuffer strBuf = new StringBuffer(); int length = path.size(); for (int i = 0; i < length; i++) { Node tempNode = (Node) path.elementAt(i); short nodeType = getNodeType(tempNode); String targetValue = getValue(tempNode, nodeType); int position = 1; tempNode = getPreviousTypedNode(tempNode, nodeType); ... |