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

Close the most recently opened element of the specified `name`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
std::ostream&
closeElement(
    std::ostream& stream,
    xref:BloombergLP/balxml/Formatter_PrettyImplUtil/State.adoc[State]* state,
    std::string&lowbar;view const& name);
----

== Description

Decrement the indent level and add the closing tag for the element of the specified `name` to the specified `stream`, with formatting depending on the specified `state`, and update `state` accordingly&period; Return the `stream`&period; If the element does not have content, write `&sol;&gt;` and a newline into stream&period; Otherwise, write `&lt;&sol;name&gt;` and a newline&period; If this `&lt;&sol;name&gt;` does not share the same line with data, or it follows another element&apos;s closing tag, indent properly before writing `&lt;&sol;name&gt;` and the newline&period; If `name` is root element, flush the output stream&period; The behavior is undefined if `name` is not the most recently opened element that&apos;s yet to be closed&period;

== 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 to close
|===


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