[#BloombergLP-balxml-Formatter_PrettyImplUtil-addElementAndData] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balxml.adoc[balxml]::xref:BloombergLP/balxml/Formatter_PrettyImplUtil.adoc[Formatter_PrettyImplUtil]::addElementAndData :relfileprefix: ../../../ :mrdocs: Add an element of the specified `name` with the specified `value` as its data content. == Synopsis Declared in `<balxml_formatter_prettyimpl.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class TYPE> static std::ostream& addElementAndData( std::ostream& stream, xref:BloombergLP/balxml/Formatter_PrettyImplUtil/State.adoc[State]* state, std::string_view const& name, TYPE const& value, int formattingMode = 0, xref:BloombergLP/balxml/EncoderOptions.adoc[EncoderOptions] const& encoderOptions = EncoderOptions()); ---- == Description Write to the specified `stream`, with formatting depending on the specified `state` and the optionally specified `encoderOptions`, and update `state` accordingly. Return the `stream`. This has the same effect as calling the following sequence: 'openElement(name); addData(value), closeElement(name);'. Optionally specify the `formattingMode`. == Return Value a reference to the modifiable `stream` == Parameters [cols="1,4"] |=== | Name| Description | *stream* | output stream to write to | *state* | formatter state to update | *name* | name of the element | *value* | data content of the element | *formattingMode* | mode used to format `value` | *encoderOptions* | options controlling encoding of `value` |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#