/** * Returns the {@link Element} with the specified <code>id</code> attribute value. * <p> * This simulates the script method * <code><a target="_blank" href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html.html#ID-36113835">getElementById</a></code> * defined in DOM HTML level 1. * <p> * This is equivalent to {@link #getFirstElement(String,String,boolean) getFirstElement}<code>("id",id,true)</code>. * <p> * A well formed HTML document should have no more than one element with any given <code>id</code> attribute value. * * @param id the <code>id</code> attribute value (case sensitive) to search for, must not be <code>null</code>. * @return the {@link Element} with the specified <code>id</code> attribute value, or <code>null</code> if no such element exists. */ public Element getElementById(final String id) { return getFirstElement(Attribute.ID,id,true); }
public static OGObject parse(Source source,Set<String> unescapeHtml){ Element htmlTag = source.getFirstElement(HTMLElementName.HTML); List<Element> elementList = source.getAllElements(HTMLElementName.META); Map<String,String> datamap = new HashMap<String,String>(); String ogPrefix = findOpenGraphNamespacePrefix(htmlTag); for (Element elem : elementList){ String attrVal = elem.getAttributeValue("property"); if (attrVal!=null && attrVal.startsWith(ogPrefix)){ String content = elem.getAttributeValue("content"); String name = attrVal.substring(OG_PREFIX_CHAR_COUNT); datamap.put(name, content); } } return parse(datamap,unescapeHtml); }
Element base = source.getFirstElement(HTMLElementName.BASE); if (base != null) { if (log.isDebugEnabled()) {
Element base = source.getFirstElement(HTMLElementName.BASE); if (base != null) { if (log.isDebugEnabled()) {