1 16 17 package org.apache.taglibs.standard.extra.spath; 18 19 20 25 public class AttributePredicate extends Predicate { 26 27 private String attribute, target; 28 29 33 public AttributePredicate(String attribute, String target) { 34 if (attribute == null) 35 throw new IllegalArgumentException ("non-null attribute needed"); 36 if (attribute.indexOf(":") != -1) 37 throw new IllegalArgumentException ( 38 "namespace-qualified attribute names are not currently " + 39 "supported"); 40 this.attribute = attribute; 41 42 if (target == null) 43 throw new IllegalArgumentException ("non-null target needed"); 44 this.target = target.substring(1, target.length() - 1); 46 } 47 48 52 public boolean isMatchingAttribute(org.xml.sax.Attributes a) { 53 String attValue = a.getValue("", attribute); 54 return (attValue != null && attValue.equals(target)); 55 } 56 } 57 | Popular Tags |