/** * Writes the given string as-is. The content string <i>must</i> be XML escaped before calling this. * If the content is null this does nothing but closing the start tag. * * @param content the content - output by XML.xmlEscape(content.toString()) * @param multiline whether the content should be treated as multiline, * such that the following end tag should appear on a new line */ public XMLWriter escapedContent(String content,boolean multiline) { closeStartTag(); if (content==null) return this; if (multiline) currentIsMultiline=true; return wTranscode(content); }
/** * Writes an attribute by XML.xmlEscape(value.toString(),false) * * @param name the name of the attribute. An exception is thrown if this is null * @param value the value of the attribute. The empty string if the attribute is null or empty */ public XMLWriter forceAttribute(Utf8String name, Object value) { String stringValue = value!=null ? value.toString() : ""; allowAttribute(); return w(SPACE).w(name).w(ATTRIBUTE_START).wTranscode(XML.xmlEscape(stringValue,true)).w(ATTRIBUTE_END); }
/** * Writes an attribute by XML.xmlEscape(value.toString(),false) * * @param name the name of the attribute. An exception is thrown if this is null * @param value the value of the attribute. This method does nothing if the value is null or empty */ public XMLWriter attribute(Utf8String name, String value) { if ((value == null) || value.isEmpty()) return this; allowAttribute(); return w(SPACE).w(name).w(ATTRIBUTE_START).wTranscode(XML.xmlEscape(value, true)).w(ATTRIBUTE_END); }