Get the title of the HTML. If no <code>title</code> tag exists, then the
title is null.

@param htmlContent
the HTML content that may contain a title
@return the title of the HTML or null if none
548969
public static String getTitle(String htmlContent) {
		Document doc = Jsoup.parse(htmlContent);
		Elements titleNode = doc.select("head > title");
		return titleNode.isEmpty() ? null : doc.title();
	}
1186130
function (textContent) {
            // String cast
            if (textContent !== null) {
                textContent = '' + textContent;
            } else {
                textContent = '';
            }
            var dom = this.getDom();
            if (dom) {
                var stringUtils = ariaUtilsString;
                this.textContent = textContent;

                dom.style.display = "inline-block";
                dom.style.overflow = "hidden";
                dom.style.whiteSpace = "nowrap";
                dom.style.verticalAlign = "top";

                var textWidth, ellipsisElement = ariaUtilsDom.getDomElementChild(dom, 0);
                if (!ellipsisElement) {
                    dom.innerHTML = '<span class="createdEllipisElement">' + stringUtils.escapeHTML(this.textContent)
                            + '</span>';
                    ellipsisElement = ariaUtilsDom.getDomElementChild(dom, 0);
                }
                if (this._cfg.width > 0) {
                    textWidth = this._cfg.width;
                    dom.style.width = this._cfg.width + "px";

                    this._ellipsis = new ariaUtilsEllipsis(ellipsisElement, textWidth, this._cfg.ellipsisLocation, this._cfg.ellipsis, this._context, this._cfg.ellipsisEndStyle);

                    if (!this._ellipsis.ellipsesNeeded) {
                        // No ellipsis was done so remove the <span> and put the full text into the text widget itself
                        dom.removeChild(ellipsisElement);
                        dom.innerHTML = stringUtils.escapeHTML(textContent);
                    }
                }

            }

        }
725702
public void title(String title) {
        Validate.notNull(title);
        Element titleEl = getElementsByTag("title").first();
        if (titleEl == null) { // add to head
            head().appendElement("title").text(title);
        } else {
            titleEl.text(title);
        }
    }
92503
public static Optional<ButtonType> showConfirmation(String title, String content) {
        return showConfirmation(title, null, content);
    }
1070061
public String html(String text) {
        if (text == null || text.isEmpty()) {
            return text;
        }
        return StringEscapeUtils.escapeHtml4(text);
    }
180296
protected String htmlTitle() {

        boolean showTitle = isShowTitle();
        Iterator<I_CmsListAction> itIndepActions = getMetadata().getIndependentActions().iterator();
        while (!showTitle && itIndepActions.hasNext()) {
            I_CmsListAction indepAction = itIndepActions.next();
            showTitle = showTitle || indepAction.isVisible();
        }
        Iterator<CmsListItemDetails> itItemDetails = getMetadata().getItemDetailDefinitions().iterator();
        while (!showTitle && itItemDetails.hasNext()) {
            CmsListItemDetails itemDetail = itItemDetails.next();
            showTitle = showTitle || itemDetail.getAction().isVisible();
        }
        if (!showTitle) {
            // prevent empty table if there is nothing to display
            return "";
        }
        StringBuffer html = new StringBuffer(512);
        CmsMessages messages = Messages.get().getBundle(getWp().getLocale());
        html.append("<table width='100%' cellspacing='0'>");
        html.append("\t<tr>\n");
        if (isShowTitle()) {
            html.append("\t\t<td align='left'>\n");
            html.append("\t\t\t");
            boolean isNotSearching = true;
            if (getMetadata().isSearchable()) {
                isNotSearching = CmsStringUtil.isEmptyOrWhitespaceOnly(m_searchFilter);
            }
            if (getTotalNumberOfPages() > 1) {
                if (isNotSearching) {
                    html.append(messages.key(
                        Messages.GUI_LIST_TITLE_TEXT_4,
                        new Object[] {
                            m_name.key(getWp().getLocale()),
                            new Integer(displayedFrom()),
                            new Integer(displayedTo()),
                            new Integer(getTotalSize())}));
                } else {
                    html.append(messages.key(
                        Messages.GUI_LIST_TITLE_FILTERED_TEXT_5,
                        new Object[] {
                            m_name.key(getWp().getLocale()),
                            new Integer(displayedFrom()),
                            new Integer(displayedTo()),
                            new Integer(getSize()),
                            new Integer(getTotalSize())}));
                }
            } else {
                if (isNotSearching) {
                    html.append(messages.key(
                        Messages.GUI_LIST_SINGLE_TITLE_TEXT_2,
                        new Object[] {m_name.key(getWp().getLocale()), new Integer(getTotalSize())}));
                } else {
                    html.append(messages.key(
                        Messages.GUI_LIST_SINGLE_TITLE_FILTERED_TEXT_3,
                        new Object[] {
                            m_name.key(getWp().getLocale()),
                            new Integer(getSize()),
                            new Integer(getTotalSize())}));
                }
            }
            html.append("\n");
            html.append("\t\t</td>\n\t\t");
        }
        html.append(getMetadata().htmlActionBar());
        html.append("\n\t</tr>\n");
        html.append("</table>\n");
        return html.toString();
    }
206545
public function getHtmlContent()
    {
        if ($this->htmlContent === null) {
            try {
                if (empty($content = $this->content)) {
                    return $this->htmlContent = false;
                }

                $errors = libxml_use_internal_errors(true);
                $entities = libxml_disable_entity_loader(true);

                $this->htmlContent = new DOMDocument();

                if (mb_detect_encoding($content, 'UTF-8', true) === 'UTF-8') {
                    $content = mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8');
                    $content = preg_replace(
                        '/<head[^>]*>/',
                        '<head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">',
                        $content
                    );
                } elseif (mb_detect_encoding($content, 'SJIS', true) === 'SJIS') {
                    $content = mb_convert_encoding($content, 'HTML-ENTITIES', 'SJIS');
                    $content = preg_replace('/<head[^>]*>/', '<head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=shift_jis">', $content);
                } elseif (mb_detect_encoding($content, 'ISO-8859-1', true) === 'ISO-8859-1') {
                    $content = mb_convert_encoding($content, 'HTML-ENTITIES', 'ISO-8859-1');
                    $content = preg_replace('/<head[^>]*>/', '<head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">', $content);
                }

                $this->htmlContent->loadHTML(trim($content));

                libxml_use_internal_errors($errors);
                libxml_disable_entity_loader($entities);
            } catch (Exception $exception) {
                return $this->htmlContent = false;
            }
        }

        return $this->htmlContent;
    }
1043351
public static HtmlTree TITLE(Content body) {
        HtmlTree htmltree = new HtmlTree(HtmlTag.TITLE, nullCheck(body));
        return htmltree;
    }
1181296
function getTextFromContent(contentNodes) {
  if (contentNodes === null) {
    return '';
  }
  const texts = [...contentNodes].map(node => node.textContent);
  const text = texts.join('').trim();
  return unescapeHtml(text);
}
1184794
protected function setHtmlContent($htmlContent)
    {
        if (is_string($htmlContent)) {
            $this->content = $htmlContent;
        } else {
            throw new \InvalidArgumentException(
                "Invalid type '" . gettype($htmlContent). "' for argument 'htmlContent' given."
            );
        }

        return $this;
    }
620750
public static String tagClassHtmlContent(String tag, String clazz, String... content) {
		return openTagClassHtmlContent(tag, clazz, content) + closeTag(tag);
	}
1137879
private function convertToHtmlEntities(string $htmlContent, string $charset = 'UTF-8'): string
    {
        set_error_handler(function () { throw new \Exception(); });

        try {
            return mb_convert_encoding($htmlContent, 'HTML-ENTITIES', $charset);
        } catch (\Exception $e) {
            try {
                $htmlContent = iconv($charset, 'UTF-8', $htmlContent);
                $htmlContent = mb_convert_encoding($htmlContent, 'HTML-ENTITIES', 'UTF-8');
            } catch (\Exception $e) {
            }

            return $htmlContent;
        } finally {
            restore_error_handler();
        }
    }
944831
public String getContent() {
		String content = "";
		
		NodeList list = dom.getChildNodes();
		for (int i=0;i<list.getLength();i++) {
			if (list.item(i) instanceof Text) {
				content += (list.item(i).getNodeValue());
			}
		}
		
		return content;
	}
1366504
public String getTitle() {
        Title title = getAnnotation(Title.class);
        return title == null ? null : title.value();
    }
1276800
public String text() {
        if (!element.is().present()) {
            return null;
        }
        WebElement webElement = element.getWebElement();
        return webElement.getText();
    }
73139
public Content getContent() {
        if (getContents() != null && !getContents().isEmpty()) {
            final Content c = getContents().get(0);
            return c;
        }
        return null;
    }
1287715
@Override
    public String getTagHtml(Tag tag) {

        if (CmsStringUtil.isEmpty(tag.getTagName())) {
            return "";
        }
        StringBuffer result = new StringBuffer(32);
        result.append('<');
        // Tag name is the first "Attribute"...
        Iterator itAttributes = tag.getAttributesEx().iterator();
        while (itAttributes.hasNext()) {
            result.append(itAttributes.next().toString());
            // avoid trailing whitespaces like <H1 >
            // in 2nd run htmlparser 1.5 would turn the whitespace into an Attribute with null name
            if (itAttributes.hasNext()) {
                result.append(' ');
            }
        }
        result.append('>');
        return result.toString();
    }