/** * Takes as input a JDOM element and return true if the element or * one of its children as an attribute with a matching name and a matching * value. */ public boolean validate (final Object o) throws QueryException { final org.jdom.Element elt = (org.jdom.Element)o; java.util.Iterator it = elt.getAttributes().iterator(); while (it.hasNext()) { final org.jdom.Attribute a = (org.jdom.Attribute)it.next(); if (a.getName().matches(getName()) && a.getValue().matches(getValue())) { //log.debug("validate() returning true"); return true; } } it = elt.getChildren().iterator(); while (it.hasNext()) if (validate(it.next())) return true; //log.debug("validate() returning false"); return false; }