/** * 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); }
/** * Writes an attribute by its utf8 value * * @param name the name of the attribute. An exception is thrown if this is null * @param value the value of the attribute. */ public XMLWriter attribute(Utf8String name, long value) { allowAttribute(); return w(SPACE).w(name).w(ATTRIBUTE_START).w(value).w(ATTRIBUTE_END); }
/** * Writes an attribute by its utf8 value * * @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. */ public XMLWriter attribute(Utf8String name, Number value) { if (value == null) return this; allowAttribute(); return w(SPACE).w(name).w(ATTRIBUTE_START).w(value).w(ATTRIBUTE_END); }
/** * Writes an attribute by its utf8 value * * @param name the name of the attribute. An exception is thrown if this is null * @param value the value of the attribute. */ public XMLWriter attribute(Utf8String name, double value) { allowAttribute(); return w(SPACE).w(name).w(ATTRIBUTE_START).w(value).w(ATTRIBUTE_END); }
/** * Writes an attribute by its utf8 value * * @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, boolean value) { allowAttribute(); return w(SPACE).w(name).w(ATTRIBUTE_START).w(value).w(ATTRIBUTE_END); }
/** * Writes an attribute by its utf8 value * * @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, AbstractUtf8Array value) { if (value.isEmpty()) return this; allowAttribute(); return w(SPACE).w(name).w(ATTRIBUTE_START).w(value).w(ATTRIBUTE_END); }