public static String xmlEscape(String s) { return Util.xmlEscape(s); }
/** * 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 &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(); }
@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; } /**
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>");
public static String xmlEscape(String s) { return Util.xmlEscape(s); }
public static String xmlEscape(String s) { return Util.xmlEscape(s); }
public static String xmlEscape(String s) { return Util.xmlEscape(s); }
public static String xmlEscape(String s) { return Util.xmlEscape(s); }
public static String xmlEscape(String s) { return Util.xmlEscape(s); }
private static String escapeForXml(String string) { return Util.xmlEscape(Util.fixNull(string)); }
private static String escapeForXml(String string) { return Util.xmlEscape(Util.fixNull(string)); }
private static String escapeForXml(String string) { return Util.xmlEscape(Util.fixNull(string)); }
private static String escapeForXml(String string) { return Util.xmlEscape(Util.fixNull(string)); }
/** * 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 &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(); }
/** * Returns the fully marked-up text. * * @param preEscape * If true, the escaping is for the <PRE> context. This leave SP and CR/LF intact. * If false, the escape is for the normal HTML, thus SP becomes &nbsp; and CR/LF becomes <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(); }
/** * Returns the fully marked-up text. * * @param preEscape * If true, the escaping is for the <PRE> context. This leave SP and CR/LF intact. * If false, the escape is for the normal HTML, thus SP becomes &nbsp; and CR/LF becomes <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(); }
/** * Returns the fully marked-up text. * * @param preEscape * If true, the escaping is for the <PRE> context. This leave SP and CR/LF intact. * If false, the escape is for the normal HTML, thus SP becomes &nbsp; and CR/LF becomes <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(); }
/** * Returns the fully marked-up text. * * @param preEscape If true, the escaping is for the <PRE> context. This * leave SP and CR/LF intact. If false, the escape is for the normal HTML, * thus SP becomes &nbsp; and CR/LF becomes <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(); }
@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; } /**
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>");