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

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

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

Util.xmlEscape介绍

暂无

代码示例

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

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

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

  1. /**
  2. * Returns the fully marked-up text.
  3. *
  4. * @param preEscape
  5. * If true, the escaping is for the {@code <PRE>} context. This leave SP and CR/LF intact.
  6. * If false, the escape is for the normal HTML, thus SP becomes &amp;nbsp; and CR/LF becomes {@code <BR>}
  7. */
  8. public String toString(boolean preEscape) {
  9. if(tags.isEmpty())
  10. return preEscape? Util.xmlEscape(text) : Util.escape(text); // the most common case
  11. Collections.sort(tags);
  12. StringBuilder buf = new StringBuilder();
  13. int copied = 0; // # of chars already copied from text to buf
  14. for (Tag tag : tags) {
  15. if (copied<tag.pos) {
  16. String portion = text.substring(copied, tag.pos);
  17. buf.append(preEscape ? Util.xmlEscape(portion) : Util.escape(portion));
  18. copied = tag.pos;
  19. }
  20. buf.append(tag.markup);
  21. }
  22. if (copied<text.length()) {
  23. String portion = text.substring(copied, text.length());
  24. buf.append(preEscape ? Util.xmlEscape(portion) : Util.escape(portion));
  25. }
  26. return buf.toString();
  27. }

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

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

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

  1. w.println(" <original>");
  2. w.print(" <name>");
  3. w.print(Util.xmlEscape(original.name));
  4. w.println("</name>");
  5. w.print(" <number>");
  6. w.println("</md5sum>");
  7. w.print(" <fileName>");
  8. w.print(Util.xmlEscape(fileName));
  9. w.println("</fileName>");
  10. w.println(" <usages>");
  11. w.println(" <entry>");
  12. w.print(" <string>");
  13. w.print(Util.xmlEscape(e.getKey()));
  14. w.println("</string>");
  15. w.print(" <ranges>");

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. /**
  2. * Returns the fully marked-up text.
  3. *
  4. * @param preEscape
  5. * If true, the escaping is for the {@code <PRE>} context. This leave SP and CR/LF intact.
  6. * If false, the escape is for the normal HTML, thus SP becomes &amp;nbsp; and CR/LF becomes {@code <BR>}
  7. */
  8. public String toString(boolean preEscape) {
  9. if(tags.isEmpty())
  10. return preEscape? Util.xmlEscape(text) : Util.escape(text); // the most common case
  11. Collections.sort(tags);
  12. StringBuilder buf = new StringBuilder();
  13. int copied = 0; // # of chars already copied from text to buf
  14. for (Tag tag : tags) {
  15. if (copied<tag.pos) {
  16. String portion = text.substring(copied, tag.pos);
  17. buf.append(preEscape ? Util.xmlEscape(portion) : Util.escape(portion));
  18. copied = tag.pos;
  19. }
  20. buf.append(tag.markup);
  21. }
  22. if (copied<text.length()) {
  23. String portion = text.substring(copied, text.length());
  24. buf.append(preEscape ? Util.xmlEscape(portion) : Util.escape(portion));
  25. }
  26. return buf.toString();
  27. }

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

  1. /**
  2. * Returns the fully marked-up text.
  3. *
  4. * @param preEscape
  5. * If true, the escaping is for the &lt;PRE> context. This leave SP and CR/LF intact.
  6. * If false, the escape is for the normal HTML, thus SP becomes &amp;nbsp; and CR/LF becomes &lt;BR>
  7. */
  8. public String toString(boolean preEscape) {
  9. if(tags.isEmpty())
  10. return preEscape? Util.xmlEscape(text) : Util.escape(text); // the most common case
  11. Collections.sort(tags);
  12. StringBuilder buf = new StringBuilder();
  13. int copied = 0; // # of chars already copied from text to buf
  14. for (Tag tag : tags) {
  15. if (copied<tag.pos) {
  16. String portion = text.substring(copied, tag.pos);
  17. buf.append(preEscape ? Util.xmlEscape(portion) : Util.escape(portion));
  18. copied = tag.pos;
  19. }
  20. buf.append(tag.markup);
  21. }
  22. if (copied<text.length()) {
  23. String portion = text.substring(copied, text.length());
  24. buf.append(preEscape ? Util.xmlEscape(portion) : Util.escape(portion));
  25. }
  26. return buf.toString();
  27. }

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

  1. /**
  2. * Returns the fully marked-up text.
  3. *
  4. * @param preEscape
  5. * If true, the escaping is for the &lt;PRE> context. This leave SP and CR/LF intact.
  6. * If false, the escape is for the normal HTML, thus SP becomes &amp;nbsp; and CR/LF becomes &lt;BR>
  7. */
  8. public String toString(boolean preEscape) {
  9. if(tags.isEmpty())
  10. return preEscape? Util.xmlEscape(text) : Util.escape(text); // the most common case
  11. Collections.sort(tags);
  12. StringBuilder buf = new StringBuilder();
  13. int copied = 0; // # of chars already copied from text to buf
  14. for (Tag tag : tags) {
  15. if (copied<tag.pos) {
  16. String portion = text.substring(copied, tag.pos);
  17. buf.append(preEscape ? Util.xmlEscape(portion) : Util.escape(portion));
  18. copied = tag.pos;
  19. }
  20. buf.append(tag.markup);
  21. }
  22. if (copied<text.length()) {
  23. String portion = text.substring(copied, text.length());
  24. buf.append(preEscape ? Util.xmlEscape(portion) : Util.escape(portion));
  25. }
  26. return buf.toString();
  27. }

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

  1. /**
  2. * Returns the fully marked-up text.
  3. *
  4. * @param preEscape
  5. * If true, the escaping is for the &lt;PRE> context. This leave SP and CR/LF intact.
  6. * If false, the escape is for the normal HTML, thus SP becomes &amp;nbsp; and CR/LF becomes &lt;BR>
  7. */
  8. public String toString(boolean preEscape) {
  9. if(tags.isEmpty())
  10. return preEscape? Util.xmlEscape(text) : Util.escape(text); // the most common case
  11. Collections.sort(tags);
  12. StringBuilder buf = new StringBuilder();
  13. int copied = 0; // # of chars already copied from text to buf
  14. for (Tag tag : tags) {
  15. if (copied<tag.pos) {
  16. String portion = text.substring(copied, tag.pos);
  17. buf.append(preEscape ? Util.xmlEscape(portion) : Util.escape(portion));
  18. copied = tag.pos;
  19. }
  20. buf.append(tag.markup);
  21. }
  22. if (copied<text.length()) {
  23. String portion = text.substring(copied, text.length());
  24. buf.append(preEscape ? Util.xmlEscape(portion) : Util.escape(portion));
  25. }
  26. return buf.toString();
  27. }

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

  1. /**
  2. * Returns the fully marked-up text.
  3. *
  4. * @param preEscape If true, the escaping is for the &lt;PRE> context. This
  5. * leave SP and CR/LF intact. If false, the escape is for the normal HTML,
  6. * thus SP becomes &amp;nbsp; and CR/LF becomes &lt;BR>
  7. */
  8. public String toString(boolean preEscape) {
  9. if (tags.isEmpty()) {
  10. return preEscape ? Util.xmlEscape(text) : Util.escape(text); // the most common case
  11. }
  12. Collections.sort(tags);
  13. StringBuilder buf = new StringBuilder();
  14. int copied = 0; // # of chars already copied from text to buf
  15. for (Tag tag : tags) {
  16. if (copied < tag.pos) {
  17. String portion = text.substring(copied, tag.pos);
  18. buf.append(preEscape ? Util.xmlEscape(portion) : Util.escape(portion));
  19. copied = tag.pos;
  20. }
  21. buf.append(tag.markup);
  22. }
  23. if (copied < text.length()) {
  24. String portion = text.substring(copied, text.length());
  25. buf.append(preEscape ? Util.xmlEscape(portion) : Util.escape(portion));
  26. }
  27. return buf.toString();
  28. }

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

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

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

  1. stream.println("\t<entry>");
  2. stream.println("\t\t<changenumber>" + change.getChangeNumber() + "</changenumber>");
  3. stream.println("\t\t<date>" + Util.xmlEscape(javaDateToStringDate(change.getDate())) + "</date>");
  4. stream.println("\t\t<description>" + Util.xmlEscape(change.getDescription()) + "</description>");
  5. stream.println("\t\t<user>" + Util.xmlEscape(change.getUser()) + "</user>");
  6. stream.println("\t\t<workspace>" + Util.xmlEscape(change.getWorkspace()) + "</workspace>");
  7. stream.println("\t\t<files>");
  8. for (Changelist.FileEntry entry : change.getFiles()) {
  9. stream.println("\t\t\t<file>");
  10. stream.println("\t\t\t\t<name>" + Util.xmlEscape(entry.getFilename()) + "</name>");
  11. stream.println("\t\t\t\t<rev>" + Util.xmlEscape(entry.getRevision()) + "</rev>");
  12. stream.println("\t\t\t\t<action>" + entry.getAction() + "</action>");
  13. stream.println("\t\t\t</file>");
  14. for (Changelist.JobEntry entry : change.getJobs()) {
  15. stream.println("\t\t\t<job>");
  16. stream.println("\t\t\t\t<name>" + Util.xmlEscape(entry.getJob()) + "</name>");
  17. stream.println("\t\t\t\t<description>" + Util.xmlEscape(entry.getDescription()) + "</description>");
  18. stream.println("\t\t\t\t<status>" + Util.xmlEscape(entry.getStatus()) + "</status>");
  19. stream.println("\t\t\t</job>");

相关文章