[#BloombergLP-balxml-Formatter_PrettyImplUtil-addElementAndData]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balxml.adoc[balxml]::xref:BloombergLP/balxml/Formatter_PrettyImplUtil.adoc[Formatter&lowbar;PrettyImplUtil]::addElementAndData
:relfileprefix: ../../../
:mrdocs:

Add element of the specified `name` and the specified `value` as the data content to the specified `stream`, with formatting depending on the specified `state` and the optionally specified `encoderOptions`, and update `state` accordingly&period; Return the `stream`&period; This has the same effect as calling the following sequence&colon; &apos;openElement(name)&semi; addData(value), closeElement(name)&semi;&apos;&period; Optionally specify the `formattingMode`&period;

== Synopsis

Declared in `&lt;balxml&lowbar;formatter&lowbar;prettyimpl&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class TYPE&gt;
static
std::ostream&
addElementAndData(
    std::ostream& stream,
    xref:BloombergLP/balxml/Formatter_PrettyImplUtil/State.adoc[State]* state,
    std::string&lowbar;view const& name,
    TYPE const& value,
    int formattingMode = 0,
    xref:BloombergLP/balxml/EncoderOptions.adoc[EncoderOptions] const& encoderOptions = EncoderOptions());
----


[.small]#Created with https://www.mrdocs.com[MrDocs]#
