/** * Return property by name, regardless of its position in the * property hierarchy. * @param name Property name * @return Named property (or null) */ public Property getByName (String name) { Property prop = null; Collection<Property> coll = _property.values (); Iterator<Property> iter = coll.iterator (); while (iter.hasNext ()) { prop = iter.next (); if ((prop = prop.getByName (name)) != null) { break; } } return prop; }
Property [] array = (Property []) _value; for (int i=0; i<array.length; i++) { Property prop = array[i].getByName (name); if (prop != null) { return prop; int len = list.size (); for (int i=0; i<len; i++) { Property prop = list.get (i).getByName (name); if (prop != null) { return prop; Iterator<Property> iter = coll.iterator (); while (iter.hasNext ()) { Property prop = iter.next ().getByName (name); if (prop != null) { return prop; Iterator<Property> iter = ((Set<Property>) _value).iterator (); while (iter.hasNext ()) { Property prop = iter.next ().getByName (name); if (prop != null) { return prop;
/** * Extract the content value associated with a given httpEquiv. * @param prop List containing the description of the meta tag * @param httpEquivValue the httpEquiv to consider * @return the content value */ public String extractHttpEquivValue(Property prop, String httpEquivValue) { if (httpEquivValue == null) return null; String value = null; Property httpEquiv = prop.getByName("Httpequiv"); if (httpEquiv != null && PropertyArity.SCALAR.equals(httpEquiv.getArity()) && PropertyType.STRING.equals(httpEquiv.getType()) ) { String val = (String)httpEquiv.getValue(); if (httpEquivValue.equalsIgnoreCase(val)) { // Look for charset in the Content property Property content = prop.getByName("Content"); if (content != null && PropertyArity.SCALAR.equals(content.getArity()) && PropertyType.STRING.equals(content.getType()) ) { value = (String)content.getValue(); } } } return value; }