gpt4 book ai didi

com.atlassian.core.util.XMLUtils.getEntityRef()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-22 21:25:05 25 4
gpt4 key购买 nike

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

XMLUtils.getEntityRef介绍

[英]Encode special XML characters into the equivalent character references. These five are defined by default for all XML documents. Converts '', '"'. and ''' to "lt", "gt", "quot", or "apos".
[中]将特殊的XML字符编码到等效的字符引用中。默认情况下,这五个是为所有XML文档定义的。将“”和“\”转换为“lt”、“gt”、“quot”或“apos”。

代码示例

代码示例来源:origin: com.atlassian.core/atlassian-core

/**
 * Append escaped version of character to the end of the StringBuilder
 */
private static void transform(final StringBuilder sb, final int codePoint, final TransformPolicy policy) {
  if (!validXml(codePoint)) {
    sb.append(policy.handle((char)codePoint));
  } else {
    String charRef = getEntityRef(codePoint);
    if (charRef != null) {
      sb.append("&").append(charRef).append(";");
    } else if ((codePoint >= ' ' && codePoint <= _lastPrintable && codePoint != 0xF7) ||
        codePoint == '\n' || codePoint == '\r' || codePoint == '\t') {
      // If the character is not printable, print as character reference.
      // Non printables are below ASCII space but not tab or line
      // terminator, ASCII delete, or above a certain Unicode threshold.
      sb.append(Character.toChars(codePoint));
    } else {
      sb.append("&#").append(codePoint).append(";");
    }
  }
}

代码示例来源:origin: com.atlassian.core/atlassian-core-xml

/**
 * Append escaped version of character to the end of the StringBuilder
 */
private static void transform(final StringBuilder sb, final char ch, final TransformPolicy policy)
{
  if (!validXml(ch))
  {
    sb.append(policy.handle(ch));
  }
  else
  {
    String charRef = getEntityRef(ch);
    if (charRef != null)
    {
      sb.append("&").append(charRef).append(";");
    }
    else if ((ch >= ' ' && ch <= _lastPrintable && ch != 0xF7) ||
        ch == '\n' || ch == '\r' || ch == '\t')
    {
      // If the character is not printable, print as character reference.
      // Non printables are below ASCII space but not tab or line
      // terminator, ASCII delete, or above a certain Unicode threshold.
      sb.append(ch);
    }
    else
    {
      sb.append("&#").append(Integer.toString(ch)).append(";");
    }
  }
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com