org.apache.commons.text.StringEscapeUtils.unescapeXml()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(171)

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

StringEscapeUtils.unescapeXml介绍

暂无

代码示例

代码示例来源:origin: org.apache.commons/commons-text

/**
 * Reverse of the above.
 *
 * @see <a href="https://issues.apache.org/jira/browse/LANG-729">LANG-729</a>
 */
@Test
public void testUnescapeXmlSupplementaryCharacters() {
  assertEquals("\uD84C\uDFB4", StringEscapeUtils.unescapeXml("&#144308;"),
      "Supplementary character must be represented using a single escape");
  assertEquals("a b c \uD84C\uDFB4", StringEscapeUtils.unescapeXml("a b c &#144308;"),
      "Supplementary characters mixed with basic characters should be decoded correctly");
}

代码示例来源:origin: org.apache.commons/commons-text

@Test
public void testStandaloneAmphersand() {
  assertEquals("<P&O>", StringEscapeUtils.unescapeHtml4("&lt;P&O&gt;"));
  assertEquals("test & <", StringEscapeUtils.unescapeHtml4("test & &lt;"));
  assertEquals("<P&O>", StringEscapeUtils.unescapeXml("&lt;P&O&gt;"));
  assertEquals("test & <", StringEscapeUtils.unescapeXml("test & &lt;"));
}

代码示例来源:origin: MegaMek/mekhq

/**
 * Unescape...well, it reverses escaping...
 */
public static String unEscape(String string) {
 return StringEscapeUtils.unescapeXml(string);
}

代码示例来源:origin: org.jgrapht/jgrapht-io

/**
 * Unescape an HTML string DOT identifier.
 *
 * @param input the input
 * @return the unescaped output
 */
private static String unescapeHtmlString(String input)
{
  if (input.charAt(0) != '<' || input.charAt(input.length() - 1) != '>') {
    return input;
  }
  String noQuotes = input.subSequence(1, input.length() - 1).toString();
  String unescaped = StringEscapeUtils.unescapeXml(noQuotes);
  return unescaped;
}

代码示例来源:origin: com.haulmont.cuba/cuba-global

public static void loadMap(Element mapElement, Map<String, String> map) {
  checkNotNullArgument(map, "map is null");
  for (Element entryElem : mapElement.elements("entry")) {
    String key = entryElem.attributeValue("key");
    if (key == null) {
      throw new IllegalStateException("No 'key' attribute");
    }
    String value = null;
    Element valueElem = entryElem.element("value");
    if (valueElem != null) {
      value = StringEscapeUtils.unescapeXml(valueElem.getText());
    }
    map.put(key, value);
  }
}

代码示例来源:origin: org.nuxeo.ecm.automation/nuxeo-automation-core

public ChainExceptionFilter(String id, String value) {
  this.id = id;
  if (value.startsWith("expr:")) {
    value = value.substring(5).trim();
    // Unescape xml checking
    value = StringEscapeUtils.unescapeXml(value);
    if (value.contains("@{")) {
      this.value = Scripting.newTemplate(value);
    } else {
      this.value = Scripting.newExpression(value);
    }
  }
}

代码示例来源:origin: org.nuxeo.ecm.automation/nuxeo-automation-core

public OperationParameters set(String key, Object valueRef) {
  if (valueRef instanceof String) {
    if (((String) valueRef).startsWith("expr:")) {
      valueRef = ((String) valueRef).substring(5).trim();
      // Unescape xml checking
      valueRef = StringEscapeUtils.unescapeXml(((String) valueRef));
      if (((String) valueRef).contains("@{")) {
        params.put(key, Scripting.newTemplate(((String) valueRef)));
      } else {
        params.put(key, Scripting.newExpression(((String) valueRef)));
      }
      return this;
    }
  }
  params.put(key, valueRef);
  return this;
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

protected AbstractCondition(Element element, String messagesPack, String filterComponentName, com.haulmont.chile.core.model.MetaClass metaClass) {
  this.messagesPack = messagesPack;
  this.filterComponentName = filterComponentName;
  name = element.attributeValue("name");
  text = StringEscapeUtils.unescapeXml(element.getText());
  this.metaClass = metaClass;
  if (text == null)
    text = "";
  caption = element.attributeValue("caption");
  MessageTools messageTools = AppBeans.get(MessageTools.class);
  locCaption = messageTools.loadString(messagesPack, caption);
  unary = Boolean.valueOf(element.attributeValue("unary"));
  inExpr = Boolean.valueOf(element.attributeValue("inExpr"));
  hidden = Boolean.valueOf(element.attributeValue("hidden"));
  required = Boolean.valueOf(element.attributeValue("required"));
  useUserTimeZone = Boolean.valueOf(element.attributeValue("useUserTimeZone"));
  entityParamWhere = element.attributeValue("paramWhere");
  entityParamView = element.attributeValue("paramView");
  width = Strings.isNullOrEmpty(element.attributeValue("width")) ? 1 : Integer.parseInt(element.attributeValue("width"));
  resolveParam(element);
}

代码示例来源:origin: org.nuxeo.ecm.automation/nuxeo-automation-core

public ChainExceptionFilter(AutomationFilterDescriptor automationFilterDescriptor) {
  id = automationFilterDescriptor.getId();
  String value = automationFilterDescriptor.getValue();
  if (value.startsWith("expr:")) {
    value = value.substring(5).trim();
    // Unescape xml checking
    value = StringEscapeUtils.unescapeXml(value);
    if (value.contains("@{")) {
      this.value = Scripting.newTemplate(value);
    } else {
      this.value = Scripting.newExpression(value);
    }
  }
}

代码示例来源:origin: com.github.julianthome/inmemantlr-api

sb.append(StringEscapeUtils.unescapeXml(n.getLabel()));
sb.append("</lbl>");

代码示例来源:origin: kanjielu/jeeves

@Override
  public void postAcceptFriendInvitation(Message message) throws IOException {
    logger.info("postAcceptFriendInvitation");
//        将该用户的微信号设置成他的昵称
    String content = StringEscapeUtils.unescapeXml(message.getContent());
    ObjectMapper xmlMapper = new XmlMapper();
    FriendInvitationContent friendInvitationContent = xmlMapper.readValue(content, FriendInvitationContent.class);
    wechatHttpService.setAlias(message.getRecommendInfo().getUserName(), friendInvitationContent.getFromusername());
  }

代码示例来源:origin: org.nuxeo.ecm.automation/nuxeo-automation-core

param.value = param.value.trim();
param.value = StringEscapeUtils.unescapeXml(param.value);
if (param.value.startsWith("expr:")) {
  String value = param.value.substring(5);

代码示例来源:origin: iterate-ch/cyberduck

if(StringUtils.isNotBlank(e.getErrorMessage())) {
  this.append(buffer, StringEscapeUtils.unescapeXml(e.getErrorMessage()));

相关文章