gpt4 book ai didi

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

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

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

XMLUtils.transformCData介绍

[英]Append escaped version of CData "character data" to the end of the StringBuilder
[中]将转义版本的CData“字符数据”附加到StringBuilder的末尾

代码示例

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

public static String escapeForCdata(String source) {
  if (source == null) {
    return null;
  }
  final StringBuilder sb = new StringBuilder();
  int index;
  int oldIndex = 0;
  while ((index = source.indexOf("]]>", oldIndex)) > -1) {
    final String str = source.substring(oldIndex, index);
    transformCData(sb, str, DEFAULT_POLICY);
    oldIndex = index + 3;
    sb.append("]]]]><![CDATA[>");
  }
  final String rest = source.substring(oldIndex);
  transformCData(sb, rest, DEFAULT_POLICY);
  return sb.toString();
}

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

public static String escapeForCdata(String source)
{
  if (source == null)
  {
    return null;
  }
  final StringBuilder sb = new StringBuilder();
  int index;
  int oldIndex = 0;
  while ((index = source.indexOf("]]>", oldIndex)) > -1)
  {
    final String str = source.substring(oldIndex, index);
    transformCData(sb, str, DEFAULT_POLICY);
    oldIndex = index + 3;
    sb.append("]]]]><![CDATA[>");
  }
  final String rest = source.substring(oldIndex);
  transformCData(sb, rest, DEFAULT_POLICY);
  return sb.toString();
}

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