private static String getMetaValue(Source source, String key) { for (int pos = 0; pos < source.length(); ) { StartTag startTag = source.getNextStartTag(pos, "name", key, false); if (startTag == null) return null; if (startTag.getName() == HTMLElementName.META) return startTag.getAttributeValue("content"); // Attribute values are automatically decoded pos = startTag.getEnd(); } return null; }
/** * Returns the {@linkplain StartTag#getName() name} of the {@linkplain #getStartTag() start tag} * of this element, always in lower case. * * <p>This is equivalent to {@link #getStartTag()}<code>.</code>{@link StartTag#getName() * getName()}. * * <p>See the {@link Tag#getName()} method for more information. * * @return the name of the {@linkplain #getStartTag() start tag} of this element, always in lower * case. */ public String getName() { return startTag.getName(); }