hudson.Util.xmlEscape()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(9.9k)|赞(0)|评价(0)|浏览(212)

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

Util.xmlEscape介绍

暂无

代码示例

代码示例来源:origin: jenkinsci/jenkins

public static String xmlEscape(String s) {
  return Util.xmlEscape(s);
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Returns the fully marked-up text.
 *
 * @param preEscape
 *      If true, the escaping is for the {@code <PRE>} context. This leave SP and CR/LF intact.
 *      If false, the escape is for the normal HTML, thus SP becomes &amp;nbsp; and CR/LF becomes {@code <BR>}
 */
public String toString(boolean preEscape) {
  if(tags.isEmpty())
    return preEscape? Util.xmlEscape(text) : Util.escape(text);  // the most common case
  Collections.sort(tags);
  StringBuilder buf = new StringBuilder();
  int copied = 0; // # of chars already copied from text to buf
  for (Tag tag : tags) {
    if (copied<tag.pos) {
      String portion = text.substring(copied, tag.pos);
      buf.append(preEscape ? Util.xmlEscape(portion) : Util.escape(portion));
      copied = tag.pos;
    }
    buf.append(tag.markup);
  }
  if (copied<text.length()) {
    String portion = text.substring(copied, text.length());
    buf.append(preEscape ? Util.xmlEscape(portion) : Util.escape(portion));
  }
  return buf.toString();
}

代码示例来源:origin: jenkinsci/jenkins

@Restricted(NoExternalUse.class)
public static String[] printLogRecordHtml(LogRecord r, LogRecord prior) {
  String[] oldParts = prior == null ? new String[4] : logRecordPreformat(prior);
  String[] newParts = logRecordPreformat(r);
  for (int i = 0; i < /* not 4 */3; i++) {
    newParts[i] = "<span class='" + (newParts[i].equals(oldParts[i]) ? "logrecord-metadata-old" : "logrecord-metadata-new") + "'>" + newParts[i] + "</span>";
  }
  newParts[3] = Util.xmlEscape(newParts[3]);
  return newParts;
}
/**

代码示例来源:origin: jenkinsci/jenkins

w.println("  <original>");
  w.print("    <name>");
  w.print(Util.xmlEscape(original.name));
  w.println("</name>");
  w.print("    <number>");
w.println("</md5sum>");
w.print("  <fileName>");
w.print(Util.xmlEscape(fileName));
w.println("</fileName>");
w.println("  <usages>");
  w.println("    <entry>");
  w.print("      <string>");
  w.print(Util.xmlEscape(e.getKey()));
  w.println("</string>");
  w.print("      <ranges>");

代码示例来源:origin: hudson/hudson-2.x

public static String xmlEscape(String s) {
  return Util.xmlEscape(s);
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

public static String xmlEscape(String s) {
  return Util.xmlEscape(s);
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

public static String xmlEscape(String s) {
  return Util.xmlEscape(s);
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

public static String xmlEscape(String s) {
  return Util.xmlEscape(s);
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

public static String xmlEscape(String s) {
  return Util.xmlEscape(s);
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-test-harness

private static String escapeForXml(String string) {
  return Util.xmlEscape(Util.fixNull(string));
}

代码示例来源:origin: org.eclipse.hudson/hudson-test-framework

private static String escapeForXml(String string) {
  return Util.xmlEscape(Util.fixNull(string));
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-test-framework

private static String escapeForXml(String string) {
  return Util.xmlEscape(Util.fixNull(string));
}

代码示例来源:origin: jenkinsci/jenkins-test-harness

private static String escapeForXml(String string) {
  return Util.xmlEscape(Util.fixNull(string));
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * Returns the fully marked-up text.
 *
 * @param preEscape
 *      If true, the escaping is for the {@code <PRE>} context. This leave SP and CR/LF intact.
 *      If false, the escape is for the normal HTML, thus SP becomes &amp;nbsp; and CR/LF becomes {@code <BR>}
 */
public String toString(boolean preEscape) {
  if(tags.isEmpty())
    return preEscape? Util.xmlEscape(text) : Util.escape(text);  // the most common case
  Collections.sort(tags);
  StringBuilder buf = new StringBuilder();
  int copied = 0; // # of chars already copied from text to buf
  for (Tag tag : tags) {
    if (copied<tag.pos) {
      String portion = text.substring(copied, tag.pos);
      buf.append(preEscape ? Util.xmlEscape(portion) : Util.escape(portion));
      copied = tag.pos;
    }
    buf.append(tag.markup);
  }
  if (copied<text.length()) {
    String portion = text.substring(copied, text.length());
    buf.append(preEscape ? Util.xmlEscape(portion) : Util.escape(portion));
  }
  return buf.toString();
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Returns the fully marked-up text.
 *
 * @param preEscape
 *      If true, the escaping is for the &lt;PRE> context. This leave SP and CR/LF intact.
 *      If false, the escape is for the normal HTML, thus SP becomes &amp;nbsp; and CR/LF becomes &lt;BR>
 */
public String toString(boolean preEscape) {
  if(tags.isEmpty())
    return preEscape? Util.xmlEscape(text) : Util.escape(text);  // the most common case
  Collections.sort(tags);
  StringBuilder buf = new StringBuilder();
  int copied = 0; // # of chars already copied from text to buf
  for (Tag tag : tags) {
    if (copied<tag.pos) {
      String portion = text.substring(copied, tag.pos);
      buf.append(preEscape ? Util.xmlEscape(portion) : Util.escape(portion));
      copied = tag.pos;
    }
    buf.append(tag.markup);
  }
  if (copied<text.length()) {
    String portion = text.substring(copied, text.length());
    buf.append(preEscape ? Util.xmlEscape(portion) : Util.escape(portion));
  }
  return buf.toString();
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Returns the fully marked-up text.
 *
 * @param preEscape
 *      If true, the escaping is for the &lt;PRE> context. This leave SP and CR/LF intact.
 *      If false, the escape is for the normal HTML, thus SP becomes &amp;nbsp; and CR/LF becomes &lt;BR>
 */
public String toString(boolean preEscape) {
  if(tags.isEmpty())
    return preEscape? Util.xmlEscape(text) : Util.escape(text);  // the most common case
  Collections.sort(tags);
  StringBuilder buf = new StringBuilder();
  int copied = 0; // # of chars already copied from text to buf
  for (Tag tag : tags) {
    if (copied<tag.pos) {
      String portion = text.substring(copied, tag.pos);
      buf.append(preEscape ? Util.xmlEscape(portion) : Util.escape(portion));
      copied = tag.pos;
    }
    buf.append(tag.markup);
  }
  if (copied<text.length()) {
    String portion = text.substring(copied, text.length());
    buf.append(preEscape ? Util.xmlEscape(portion) : Util.escape(portion));
  }
  return buf.toString();
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Returns the fully marked-up text.
 *
 * @param preEscape
 *      If true, the escaping is for the &lt;PRE> context. This leave SP and CR/LF intact.
 *      If false, the escape is for the normal HTML, thus SP becomes &amp;nbsp; and CR/LF becomes &lt;BR>
 */
public String toString(boolean preEscape) {
  if(tags.isEmpty())
    return preEscape? Util.xmlEscape(text) : Util.escape(text);  // the most common case
  Collections.sort(tags);
  StringBuilder buf = new StringBuilder();
  int copied = 0; // # of chars already copied from text to buf
  for (Tag tag : tags) {
    if (copied<tag.pos) {
      String portion = text.substring(copied, tag.pos);
      buf.append(preEscape ? Util.xmlEscape(portion) : Util.escape(portion));
      copied = tag.pos;
    }
    buf.append(tag.markup);
  }
  if (copied<text.length()) {
    String portion = text.substring(copied, text.length());
    buf.append(preEscape ? Util.xmlEscape(portion) : Util.escape(portion));
  }
  return buf.toString();
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
 * Returns the fully marked-up text.
 *
 * @param preEscape If true, the escaping is for the &lt;PRE> context. This
 * leave SP and CR/LF intact. If false, the escape is for the normal HTML,
 * thus SP becomes &amp;nbsp; and CR/LF becomes &lt;BR>
 */
public String toString(boolean preEscape) {
  if (tags.isEmpty()) {
    return preEscape ? Util.xmlEscape(text) : Util.escape(text);  // the most common case
  }
  Collections.sort(tags);
  StringBuilder buf = new StringBuilder();
  int copied = 0; // # of chars already copied from text to buf
  for (Tag tag : tags) {
    if (copied < tag.pos) {
      String portion = text.substring(copied, tag.pos);
      buf.append(preEscape ? Util.xmlEscape(portion) : Util.escape(portion));
      copied = tag.pos;
    }
    buf.append(tag.markup);
  }
  if (copied < text.length()) {
    String portion = text.substring(copied, text.length());
    buf.append(preEscape ? Util.xmlEscape(portion) : Util.escape(portion));
  }
  return buf.toString();
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

@Restricted(NoExternalUse.class)
public static String[] printLogRecordHtml(LogRecord r, LogRecord prior) {
  String[] oldParts = prior == null ? new String[4] : logRecordPreformat(prior);
  String[] newParts = logRecordPreformat(r);
  for (int i = 0; i < /* not 4 */3; i++) {
    newParts[i] = "<span class='" + (newParts[i].equals(oldParts[i]) ? "logrecord-metadata-old" : "logrecord-metadata-new") + "'>" + newParts[i] + "</span>";
  }
  newParts[3] = Util.xmlEscape(newParts[3]);
  return newParts;
}
/**

代码示例来源:origin: org.jvnet.hudson.plugins/perforce

stream.println("\t<entry>");
stream.println("\t\t<changenumber>" + change.getChangeNumber() + "</changenumber>");
stream.println("\t\t<date>" + Util.xmlEscape(javaDateToStringDate(change.getDate())) + "</date>");
stream.println("\t\t<description>" + Util.xmlEscape(change.getDescription()) + "</description>");
stream.println("\t\t<user>" + Util.xmlEscape(change.getUser()) + "</user>");
stream.println("\t\t<workspace>" + Util.xmlEscape(change.getWorkspace()) + "</workspace>");
stream.println("\t\t<files>");
for (Changelist.FileEntry entry : change.getFiles()) {
  stream.println("\t\t\t<file>");
  stream.println("\t\t\t\t<name>" + Util.xmlEscape(entry.getFilename()) + "</name>");
  stream.println("\t\t\t\t<rev>" + Util.xmlEscape(entry.getRevision()) + "</rev>");
  stream.println("\t\t\t\t<action>" + entry.getAction() + "</action>");
  stream.println("\t\t\t</file>");
for (Changelist.JobEntry entry : change.getJobs()) {
  stream.println("\t\t\t<job>");
  stream.println("\t\t\t\t<name>" + Util.xmlEscape(entry.getJob()) + "</name>");
  stream.println("\t\t\t\t<description>" + Util.xmlEscape(entry.getDescription()) + "</description>");
  stream.println("\t\t\t\t<status>" + Util.xmlEscape(entry.getStatus()) + "</status>");
  stream.println("\t\t\t</job>");

相关文章