org.jsoup.parser.Parser.unescapeEntities()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(374)

本文整理了Java中org.jsoup.parser.Parser.unescapeEntities()方法的一些代码示例,展示了Parser.unescapeEntities()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parser.unescapeEntities()方法的具体详情如下:
包路径:org.jsoup.parser.Parser
类名称:Parser
方法名:unescapeEntities

Parser.unescapeEntities介绍

[英]Utility method to unescape HTML entities from a string
[中]从字符串中取消显示HTML实体的实用方法

代码示例

代码示例来源:origin: org.jsoup/jsoup

/**
 * Unescape the input string.
 *
 * @param string to un-HTML-escape
 * @param strict if "strict" (that is, requires trailing ';' char, otherwise that's optional)
 * @return unescaped string
 */
static String unescape(String string, boolean strict) {
  return Parser.unescapeEntities(string, strict);
}

代码示例来源:origin: com.vaadin/vaadin-server

/**
 * <p>
 * Decodes HTML entities in a text from text node and replaces them with
 * actual characters.
 * </p>
 *
 * <p>
 * Typically this method will be used by components to read back data (like
 * option items in {@code AbstractSelect}) from HTML. Note that this method
 * unencodes more characters than {@link #encodeForTextNode(String)} encodes
 * </p>
 *
 * @since 7.6
 * @param input
 * @return
 */
public static String decodeFromTextNode(String input) {
  return Parser.unescapeEntities(input, false);
}

代码示例来源:origin: TeamNewPipe/NewPipeExtractor

org.jsoup.parser.Parser.unescapeEntities(url_data_str, true));

代码示例来源:origin: apache/ofbiz-framework

String localRequestName = Parser.unescapeEntities(target, true);
localRequestName = UtilHttp.encodeAmpersands(localRequestName);

代码示例来源:origin: mkalus/segrada

@Override
  public String toPlain(String markupText) {
    // sane default
    if (markupText == null || markupText.equals("")) return "";

    // first clean to have valid html
    String cleaned = Jsoup.clean(markupText, Whitelist.basic());
    // then strip all html out
    cleaned = Jsoup.clean(cleaned, Whitelist.none());

    // unescape all entities
    cleaned = Parser.unescapeEntities(cleaned, false);

    // clean further
    return super.toPlain(cleaned);
  }
}

代码示例来源:origin: opacapp/opacclient

item.setBarcode(Parser.unescapeEntities(lines[1].trim(), false));
  item.setStatus(Parser.unescapeEntities(lines[2].trim(), false));
} else if (lines.length == 2) {
  item.setAuthor(Parser.unescapeEntities(lines[1].trim(), false));

代码示例来源:origin: apache/ofbiz-framework

propertyElem.setAttribute("key", Parser.unescapeEntities(labelInfo.getLabelKey(), true));
if (UtilValidate.isNotEmpty(labelInfo.getLabelKeyComment())) {
  Comment labelKeyComment = resourceDocument.createComment(Parser.unescapeEntities(labelInfo.getLabelKeyComment(), true));
  Node parent = propertyElem.getParentNode();
  parent.insertBefore(labelKeyComment, propertyElem);
    valueString = Parser.unescapeEntities(valueString, true);
    Element valueElem = UtilXml.addChildElementValue(propertyElem, "value", valueString, resourceDocument);
    valueElem.setAttribute("xml:lang", localeFound);
    if (UtilValidate.isNotEmpty(labelValue.getLabelComment())) {
      Comment labelComment = resourceDocument.createComment(Parser.unescapeEntities(labelValue.getLabelComment(), true));
      Node parent = valueElem.getParentNode();
      parent.insertBefore(labelComment, valueElem);

相关文章