private static final void writeAttr(Writer out, String name, String value) throws IOException { out.write(' '); out.write(name); out.write("=\""); out.write(XMLs.encodeAttribute(value)); out.write('"'); }
private static final void writeAttr(Writer out, String name, String value) throws IOException { out.write(' '); out.write(name); out.write("=\""); out.write(XMLs.encodeAttribute(value)); out.write('"'); } }
/** Appends an attribute to the string buffer, * if <code>attrValue</code> is not null. */ protected static final void append(StringBuffer sb, String attrName, String attrValue) { if (attrValue != null) sb.append(' ').append(attrName).append("=\"").append(XMLs.encodeAttribute(attrValue)).append('"'); //it might contain " or other special characters }
/** Appends an attribute to the string buffer for HTML/XML (name="val"). * If val is null or empty (if String), nothing is generated. * * <p>Note: {@link XMLs#encodeAttribute} is called automatically * to encode val. */ public static final void appendAttribute(StringBuffer sb, String name, String val) { if (val != null && val.length() != 0) sb.append(' ').append(name).append("=\"") .append(XMLs.encodeAttribute(val)).append('"'); } /** Appends an attribute to the string buffer for HTML/XML (name="val").
/** Appends an attribute to the string buffer for HTML/XML (name="val"). * If emptyIgnored is true and val is null or empty (if String), * nothing is generated. * * <p>Note: {@link XMLs#encodeAttribute} is called automatically * to encode val. * * @param emptyIgnored whether to ignore a null or empty string. * If false, it is always generated (null is generated as "null"). */ public static final void appendAttribute(StringBuffer sb, String name, String val, boolean emptyIgnored) { if (!emptyIgnored || (val != null && val.length() != 0)) sb.append(' ').append(name).append("=\"") .append(val != null ? XMLs.encodeAttribute(val): null) .append('"'); } /** Appends an attribute with a int value to the string buffer for HTML/XML (name="val").
/** * @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(); }