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

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

本文整理了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

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

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

  1. /**
  2. * <p>
  3. * Decodes HTML entities in a text from text node and replaces them with
  4. * actual characters.
  5. * </p>
  6. *
  7. * <p>
  8. * Typically this method will be used by components to read back data (like
  9. * option items in {@code AbstractSelect}) from HTML. Note that this method
  10. * unencodes more characters than {@link #encodeForTextNode(String)} encodes
  11. * </p>
  12. *
  13. * @since 7.6
  14. * @param input
  15. * @return
  16. */
  17. public static String decodeFromTextNode(String input) {
  18. return Parser.unescapeEntities(input, false);
  19. }

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

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

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

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

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

  1. @Override
  2. public String toPlain(String markupText) {
  3. // sane default
  4. if (markupText == null || markupText.equals("")) return "";
  5. // first clean to have valid html
  6. String cleaned = Jsoup.clean(markupText, Whitelist.basic());
  7. // then strip all html out
  8. cleaned = Jsoup.clean(cleaned, Whitelist.none());
  9. // unescape all entities
  10. cleaned = Parser.unescapeEntities(cleaned, false);
  11. // clean further
  12. return super.toPlain(cleaned);
  13. }
  14. }

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

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

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

  1. propertyElem.setAttribute("key", Parser.unescapeEntities(labelInfo.getLabelKey(), true));
  2. if (UtilValidate.isNotEmpty(labelInfo.getLabelKeyComment())) {
  3. Comment labelKeyComment = resourceDocument.createComment(Parser.unescapeEntities(labelInfo.getLabelKeyComment(), true));
  4. Node parent = propertyElem.getParentNode();
  5. parent.insertBefore(labelKeyComment, propertyElem);
  6. valueString = Parser.unescapeEntities(valueString, true);
  7. Element valueElem = UtilXml.addChildElementValue(propertyElem, "value", valueString, resourceDocument);
  8. valueElem.setAttribute("xml:lang", localeFound);
  9. if (UtilValidate.isNotEmpty(labelValue.getLabelComment())) {
  10. Comment labelComment = resourceDocument.createComment(Parser.unescapeEntities(labelValue.getLabelComment(), true));
  11. Node parent = valueElem.getParentNode();
  12. parent.insertBefore(labelComment, valueElem);

相关文章