[#BloombergLP-balxml-Formatter_PrettyImplUtil-addAttribute] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balxml.adoc[balxml]::xref:BloombergLP/balxml/Formatter_PrettyImplUtil.adoc[Formatter_PrettyImplUtil]::addAttribute :relfileprefix: ../../../ :mrdocs: Add an attribute of the specified `name` and specified `value` to the currently open element in the specified `stream`, with formatting depending on the specified `state`, and update the `state` accordingly. Return the `stream`. `value` can be of the following types: `char`, `short`, `int`, `bsls::Types::Int64`, `float`, `double`, `bsl::string`, `bdlt::Datetime`, `bdlt::Date`, and `bdlt::Time`. Precede this name="value" pair with a single space. Wrap line (write the attribute on next line with proper indentation), if the length of name="value" is too long. Optionally specify `formattingMode` and `encoderOptions` to control the formatting of `value`. If `value` is of type `bsl::string`, it is truncated at any invalid UTF‐8 byte‐sequence or any control character. The list of invalid control characters includes characters in the range `[0x00, 0x20)]` and `0x7F` (DEL) but does not include `0x9`, `0xA`, and `0x0D`. The five special characters: apostrophe, double quote, ampersand, less than, and greater than are escaped in the output XML. If `value` is of type `char`, it is cast to a signed byte value with a range `[ ‐128 .. 127 ]`. The behavior is undefined unless the last manipulator was `openElement` or `addAttribute`. == Synopsis Declared in `<balxml_formatter_prettyimpl.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class VALUE_TYPE> static std::ostream& addAttribute( std::ostream& stream, xref:BloombergLP/balxml/Formatter_PrettyImplUtil/State.adoc[State]* state, std::string_view const& name, VALUE_TYPE const& value, int formattingMode = 0, xref:BloombergLP/balxml/EncoderOptions.adoc[EncoderOptions] const& encoderOptions = EncoderOptions()); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#