gpt4 book ai didi

org.zkoss.xml.XMLs.encodeText()方法的使用及代码示例

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

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

XMLs.encodeText介绍

[英]Encodes a value such that it could be enclosed by an XML element.

Note: It is sometime improper to use CDATA if the text contains CDATA, too. The simplest way is NOT to use CDATA but encoding the string by this method.
[中]对值进行编码,使其可以被XML元素包围。
注意:如果文本也包含CDATA,则有时使用CDATA是不合适的。最简单的方法不是使用CDATA,而是使用此方法对字符串进行编码。

代码示例

代码示例来源:origin: org.zkoss.zk/zk

/** 
 * Internal Use Only.
 */
private static String escapeParam(String param) {
  return Strings.escape(XMLs.encodeText(param), Strings.ESCAPE_JAVASCRIPT);
}

代码示例来源:origin: org.zkoss.zk/zul

/** Render the crawlable text.
 * If crawlable is not enabled or the text is empty, nothing is generated.
 * @param text the text that is crawlable.
 * If null or empty, nothing is generated.
 * @since 5.0.0
 */
public static void renderCrawlableText(String text) throws IOException {
  if (text != null && text.length() > 0) {
    final HtmlPageRenders.RenderContext rc = HtmlPageRenders.getRenderContext(null);
    if (rc != null && rc.crawlable) {
      final Writer cwout = rc.temp;
      cwout.write("<div>");
      cwout.write(XMLs.encodeText(text));
      //encode required since it might not be valid HTML
      cwout.write("</div>\n");
    }
  }
}

代码示例来源:origin: org.zkoss.zk/zhtml

public void redraw(Writer out) throws IOException {
  final Execution exec = Executions.getCurrent();
  if (!HtmlPageRenders.isDirectContent(exec)) {
    super.redraw(out);
    return;
  }
  final boolean idRequired = isIdRequired();
  if (idRequired) {
    out.write("<span id=\"");
    out.write(getUuid());
    out.write("\">");
  }
  out.write(_encode ? XMLs.encodeText(_value) : _value);
  if (idRequired)
    out.write("</span>");
  final TagRenderContext rc = PageRenderer.getTagRenderContext(exec);
  if (rc != null) {
    rc.renderBegin(this, getClientEvents(), getSpecialRendererOutput(this), false);
    rc.renderEnd(this);
  }
}

代码示例来源:origin: org.zkoss.zk/zk

sid = escapeParam(request.getParameter("sid"));
desktop = ((WebAppCtrl) sess.getWebApp()).getDesktopCache(sess)
    .getDesktop(XMLs.encodeText(request.getParameter("dtid")));

代码示例来源:origin: org.zkoss.common/zweb

data = ("(window.zk&&zk.error?zk.error:alert)('" + XMLs.encodeText(pi) + " not found');")
    .getBytes("UTF-8");

代码示例来源:origin: org.zkoss.zk/zk

} else {
  String msg = wapp.getConfiguration().getTimeoutMessage(deviceType);
  dtid = XMLs.encodeText(dtid); // Fix ZK-1862 security issue
  if (msg != null && msg.startsWith("label:")) {
    final String key;

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