List of usage examples for org.dom4j NodeFilter matches
boolean matches(Node node);
matches
returns true if the given node matches the filter condition.
From source file:org.apache.taglibs.xtags.xpath.AbstractTag.java
License:Apache License
/** @return true if the given filter matches a node in the * input nodes/* w w w . j av a 2s . com*/ */ public boolean matches(NodeFilter filter) { Object input = getInputNodes(false); if (input == null) { // use an empty document to support // filters that just use XPath variables // such as "$foo='bar'" input = EMPTY_DOCUMENT; } if (input instanceof List) { List list = (List) input; for (Iterator iter = list.iterator(); iter.hasNext();) { Object object = iter.next(); if (object instanceof Node) { Node node = (Node) object; if (filter.matches(node)) { return true; } } } } else if (input instanceof Node) { Node node = (Node) input; if (filter.matches(node)) { return true; } } return false; }