/** * Returns the {@linkplain CharacterReference#decode(CharSequence) decoded} value of the attribute with the specified name (case insensitive). * <p> * Returns <code>null</code> if this start tag does not {@linkplain StartTagType#hasAttributes() have attributes}, * no attribute with the specified name exists or the attribute {@linkplain Attribute#hasValue() has no value}. * <p> * This is equivalent to {@link #getAttributes()}<code>.</code>{@link Attributes#getValue(String) getValue(attributeName)}, * except that it returns <code>null</code> if this start tag does not have attributes instead of throwing a * <code>NullPointerException</code>. * * @param attributeName the name of the attribute to get. * @return the {@linkplain CharacterReference#decode(CharSequence) decoded} value of the attribute with the specified name, or <code>null</code> if the attribute does not exist or {@linkplain Attribute#hasValue() has no value}. */ public String getAttributeValue(final String attributeName) { return attributes==null ? null : attributes.getValue(attributeName); }
public String getAttributeValue(final String attributeName) { if (attributesMap!=null) return attributesMap.get(attributeName); else return element.getAttributes().getValue(attributeName); }
public ElementContainer(final Element element, final boolean loadPredefinedValue) { this.element=element; predefinedValue=loadPredefinedValue ? element.getAttributes().getValue(Attribute.VALUE) : null; }
protected Tag constructTagAt(final Source source, final int pos) { final StartTag startTag=(StartTag)super.constructTagAt(source,pos); if (startTag==null) return null; // A PHP script element requires the attribute language="php". if (!"php".equalsIgnoreCase(startTag.getAttributes().getValue("language"))) return null; return startTag; } }
boolean hasAttribute(final String attributeName, final String value, final boolean valueCaseSensitive) { if (attributes==null) return false; final String attributeValue=attributes.getValue(attributeName); if (attributeValue==null) return false; if (value.equals(attributeValue)) return true; if (!valueCaseSensitive || source.logger.isWarnEnabled()) { if (value.equalsIgnoreCase(attributeValue)) { if (!valueCaseSensitive) return true; if (source.logger.isWarnEnabled()) source.logger.warn(getRowColumnVector().appendTo(new StringBuilder(200)).append(": StartTag with attribute ").append(attributeName).append("=\"").append(attributeValue).append("\" ignored during search because its case does not match search value \"").append(value).append('"').toString()); } } return false; }
private FormControl(final Element element, final FormControlType formControlType, final boolean loadPredefinedValue) { super(element.source,element.begin,element.end); elementContainer=new ElementContainer(element,loadPredefinedValue); this.formControlType=formControlType; name=element.getAttributes().getValue(Attribute.NAME); verifyName(); }
/** * Return the {@link LocalComponent} definition for a given DOM {@link Element} * * @param element Current element being processed * @return An Optional {@link LocalComponent} */ private Optional<LocalComponent> getLocalComponentForElement(Element element) { String componentName = element.getAttributes().getValue("is"); if (componentName == null) { componentName = element.getStartTag().getName(); } return context.getLocalComponent(componentName); }