/** Encodes a string that special characters are quoted to be compatible * with HTML/XML. * For example, < is translated to &lt;. * * & -> &amp;<br/> * < -> &lt;<br/> * > -> &gt;<br/> * " -> &#034;<br/> * ' -> &#039;<br/> * * @param s the string to quote; null is OK * @return the escaped string, or an empty string if s is null */ public static final String escapeXML(String s) { if (s == null) return ""; final StringBuffer sb = new StringBuffer(s.length() + 16); for (int j = 0, len = s.length(); j < len; ++j) { final char cc = s.charAt(j); final String esc = escapeXML(cc); if (esc != null) sb.append(esc); else sb.append(cc); } return s.length() == sb.length() ? s: sb.toString(); } /** Escapes a character into a string if it is a special XML character,
/** * @param hideUuidIfNoId * whether not to generate UUID if possible */ /* package */ String getPrologHalf(boolean hideUuidIfNoId) { final StringBuilder sb = new StringBuilder(128).append('<').append(_tagnm); if ((!hideUuidIfNoId && !shallHideId()) || getId().length() > 0) sb.append(" id=\"").append(getUuid()).append('"'); if (_props != null) { for (Iterator it = _props.entrySet().iterator(); it.hasNext();) { final Map.Entry me = (Map.Entry) it.next(); if (!"textContent".equals(me.getKey())) { // ignore textContent // ZK-3011: should getValue if it's a deferredValue Object v = me.getValue(); if (v instanceof DeferredValue) { v = ((DeferredValue) v).getValue(); } sb.append(' ').append(me.getKey()).append("=\"") .append(XMLs.encodeAttribute(Objects.toString(v))).append('"'); } } } if (!isOrphanTag()) sb.append('/'); sb.append('>'); Object textContent = getDynamicProperty("textContent"); if (textContent != null) sb.append(XMLs.escapeXML((String) textContent)); return sb.toString(); }
replace = " "; else replace = XMLs.escapeXML(cc);
response.sendError(HttpServletResponse.SC_NOT_FOUND, XMLs.escapeXML(path)); return;
log.error("Not found: " + path); response.sendError(HttpServletResponse.SC_NOT_FOUND, XMLs.escapeXML(path)); return;
if (Servlets.isIncluded(request)) log.error("Resource not found: " + Encodes.encodeURI(pi)); response.sendError(HttpServletResponse.SC_NOT_FOUND, XMLs.escapeXML(pi)); return;