/** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public NodeList selectNodeList(Node contextNode, String str) throws TransformerException { return selectNodeList(contextNode, str, contextNode); }
/** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public NodeList selectNodeList(Node contextNode, String str) throws TransformerException { return selectNodeList(contextNode, str, contextNode); }
/** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public NodeList selectNodeList(Node contextNode, String str) throws TransformerException { return selectNodeList(contextNode, str, contextNode); }
/** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public NodeList selectNodeList(Node contextNode, String str) throws TransformerException { return selectNodeList(contextNode, str, contextNode); }
/** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public NodeList selectNodeList(Node contextNode, String str) throws TransformerException { return selectNodeList(contextNode, str, contextNode); }
/** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public NodeList selectNodeList(Node contextNode, String str) throws TransformerException { return selectNodeList(contextNode, str, contextNode); }
/** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public NodeList selectNodeList(Node contextNode, String str) throws TransformerException { return selectNodeList(contextNode, str, contextNode); }
/** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public NodeList selectNodeList(Node contextNode, String str) throws TransformerException { return selectNodeList(contextNode, str, contextNode); }
/** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public NodeList selectNodeList(Node contextNode, String str) throws TransformerException { return selectNodeList(contextNode, str, contextNode); }
/** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public NodeList selectNodeList(Node contextNode, String str) throws TransformerException { return selectNodeList(contextNode, str, contextNode); }
/** * Use an XPath string to select a nodelist. * XPath namespace prefixes are resolved from the contextNode. * * @param contextNode The node to start searching from. * @param str A valid XPath string. * @return A NodeIterator, should never be null. * * @throws TransformerException */ public NodeList selectNodeList(Node contextNode, String str) throws TransformerException { return selectNodeList(contextNode, str, contextNode); }
public NodeList selectNodeList(Node contextNode, String expression) throws JRException { try { return xpathAPI.selectNodeList(contextNode, expression); } catch (TransformerException e) { throw new JRException("XPath selection failed. Expression: " + expression, e); } }
protected NodeList selectNodeList(Node source, String expression) { try { return xpath.selectNodeList(source, expression); } catch (TransformerException transformerException) { throw wrapException(transformerException); } }
protected NodeList selectNodeList(Node source, String expression) { try { return xpath.selectNodeList(source, expression); } catch (TransformerException transformerException) { throw wrapException(transformerException); } }
protected NodeList selectNodeList(Node source, String expression) { try { return xpath.selectNodeList(source, expression); } catch (TransformerException transformerException) { throw wrapException(transformerException); } }
protected NodeList selectNodeList(Node source, String expression) { try { return xpath.selectNodeList(source, expression); } catch (TransformerException transformerException) { throw wrapException(transformerException); } }
protected NodeList selectNodeList(Node source, String expression) { try { return xpath.selectNodeList(source, expression); } catch (TransformerException transformerException) { throw wrapException(transformerException); } }
protected NodeList selectNodeList(Node source, String expression) { try { return xpath.selectNodeList(source, expression); } catch (TransformerException transformerException) { throw wrapException(transformerException); } }
protected String getBaseHref(final Document document) { NodeList list; try { list = getXPathAPI().selectNodeList(document, "//BASE"); } catch (final Exception e) { logger.warn("Could not get a base tag. ", e); return null; } if (list.getLength() > 0) { final Element element = (Element) list.item(0); String attrValue = element.getAttribute("href"); if (StringUtil.isNotBlank(attrValue)) { // if starting with www, append a protocol if (attrValue.startsWith("www.")) { attrValue = "http://" + attrValue; } return attrValue; } } return null; }
protected List<String> getUrlFromTagAttribute(final URL url, final Document document, final String xpath, final String attr, final String encoding) { if (logger.isDebugEnabled()) { logger.debug("Base URL: " + url); } final List<String> urlList = new ArrayList<String>(); try { final NodeList list = getXPathAPI().selectNodeList(document, xpath); for (int i = 0; i < list.getLength(); i++) { final Element element = (Element) list.item(i); final String attrValue = element.getAttribute(attr); if (isValidPath(attrValue)) { addChildUrlFromTagAttribute(urlList, url, attrValue, encoding); } } } catch (final TransformerException e) { logger.warn("Could not get urls: (" + xpath + ", " + attr + ")", e); } return urlList; }