@SuppressWarnings( "unchecked" ) private boolean applyXPath() { try { XPath xpath = data.document.createXPath( data.PathValue ); if ( meta.isNamespaceAware() ) { xpath = data.document.createXPath( addNSPrefix( data.PathValue, data.PathValue ) ); xpath.setNamespaceURIs( data.NAMESPACE ); } // get nodes list data.an = xpath.selectNodes( data.document ); data.nodesize = data.an.size(); data.nodenr = 0; } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "GetXMLData.Log.ErrorApplyXPath", e.getMessage() ) ); return false; } return true; }
XPath xExclude = dom.createXPath(exclude); xExclude.setFunctionContext(functionContext); List<org.dom4j.Node> list = (List<org.dom4j.Node>)xExclude.selectNodes(dom); for (org.dom4j.Node n : list) { Element parent = n.getParent(); XPath comp = dom.createXPath(xpath); comp.setFunctionContext(functionContext); List list = comp.selectNodes(dom);
public List<Node> getRows() { if (rows == null) { rows = definition.getRowXPath().selectNodes(source); } return rows; }
public List<Node> selectNodes(String xpathExpression) { XPath xpath = createXPath(xpathExpression); return xpath.selectNodes(this); }
/** * <p> * <code>selectNodes</code> performs the given XPath expression on the * {@link List}of {@link Node}instances appending all the results together * into a single list. * </p> * * @param xpathFilterExpression * is the XPath filter expression to evaluate * @param nodes * is the list of nodes on which to evalute the XPath * * @return the results of all the XPath evaluations as a single list */ public static List<Node> selectNodes(String xpathFilterExpression, List<Node> nodes) { XPath xpath = createXPath(xpathFilterExpression); return xpath.selectNodes(nodes); }
/** * <p> * <code>selectNodes</code> performs the given XPath expression on the * {@link List}of {@link Node}instances appending all the results together * into a single list. * </p> * * @param xpathFilterExpression * is the XPath filter expression to evaluate * @param node * is the Node on which to evalute the XPath * * @return the results of all the XPath evaluations as a single list */ public static List<Node> selectNodes(String xpathFilterExpression, Node node) { XPath xpath = createXPath(xpathFilterExpression); return xpath.selectNodes(node); }
public List<Node> selectNodes(String xpathExpression, String comparisonXPathExpression, boolean removeDuplicates) { XPath xpath = createXPath(xpathExpression); XPath sortBy = createXPath(comparisonXPathExpression); return xpath.selectNodes(this, sortBy, removeDuplicates); }
/** * Processes the result of the xpath expression in the given mode. The xpath * expression is evaluated against the provided input object. * * @param input * the input object * @param xpath * the xpath expression * @param mode * the mode * @throws Exception * if something goes wrong */ public void applyTemplates(Object input, XPath xpath, String mode) throws Exception { Mode mod = ruleManager.getMode(mode); List<Node> list = xpath.selectNodes(input); for (Node current : list) { mod.fireRule(current); } }
public List getRows() { if (rows == null) { rows = definition.getRowXPath().selectNodes(source); } return rows; }
public List<Node> getRows() { if (rows == null) { rows = definition.getRowXPath().selectNodes(source); } return rows; }
public List getRows() { if (rows == null) { rows = definition.getRowXPath().selectNodes(source); } return rows; }
public List getRows() { if (rows == null) { rows = definition.getRowXPath().selectNodes(source); } return rows; }
private static String first(Document doc, String selector) { XPath xpath = DocumentHelper.createXPath(selector); try { return Iterables.get((List<Element>) xpath.selectNodes(doc), 0).getText(); } catch (IndexOutOfBoundsException e) { throw new RuntimeException("Malformed response for " + selector + " in " + doc.asXML()); } }
public List<Node> selectNodes(String xpathExpression, String comparisonXPathExpression, boolean removeDuplicates) { XPath xpath = createXPath(xpathExpression); XPath sortBy = createXPath(comparisonXPathExpression); return xpath.selectNodes(this, sortBy, removeDuplicates); }
public List selectNodes(String xpathExpression, String comparisonXPathExpression, boolean removeDuplicates) { XPath xpath = createXPath(xpathExpression); XPath sortBy = createXPath(comparisonXPathExpression); return xpath.selectNodes(this, sortBy, removeDuplicates); }
public List selectNodes(String xpathExpression, String comparisonXPathExpression, boolean removeDuplicates) { XPath xpath = createXPath(xpathExpression); XPath sortBy = createXPath(comparisonXPathExpression); return xpath.selectNodes(this, sortBy, removeDuplicates); }
private List<Node> findNodesMatchingInDoc(Document pomXml, String xpath) { XPath xpathForPluginManagement = pomXml.createXPath(xpath); xpathForPluginManagement.setNamespaceURIs(namespaceUris); return xpathForPluginManagement.selectNodes(pomXml); }
public List selectNodes(String xpathExpression, String comparisonXPathExpression, boolean removeDuplicates) { XPath xpath = createXPath(xpathExpression); XPath sortBy = createXPath(comparisonXPathExpression); return xpath.selectNodes(this, sortBy, removeDuplicates); }
protected void testXPath(String xpathText) { XPath xpath = createXPath(xpathText); List<Node> list = xpath.selectNodes(document); log("Searched path: " + xpathText + " found: " + list.size() + " result(s)"); assertTrue("Results should not contain the root node", !list .contains(rootNode)); }
protected void testXPath(String xpathText) { XPath xpath = DocumentHelper.createXPath(xpathText); SimpleNamespaceContext context = new SimpleNamespaceContext(); context.addNamespace("xplt", "www.xxxx.com"); context.addNamespace("xpl", "www.xxxx.com"); xpath.setNamespaceContext(context); List list = xpath.selectNodes(document); log("Searched path: " + xpathText + " found: " + list.size() + " result(s)"); assertTrue("Should have found at lest one result", list.size() > 0); }