[#BloombergLP-balxml-Formatter-addValidComment] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balxml.adoc[balxml]::xref:BloombergLP/balxml/Formatter.adoc[Formatter]::addValidComment :relfileprefix: ../../../ :mrdocs: Write the specified `comment` into the stream. Optionally specify `forceNewline` that specifies if a new line should be added before the comment if it is not already on a new line. If `forceNewline` is not specified then a new line is inserted for comments not already on a new line. Also optionally specify an `omitEnclosingWhitespace` that specifies if a space character should be omitted before and after `comment`. If `omitEnclosingWhitespace` is not specified then a space character is inserted before and after `comment`. Return 0 on success, and non‐zero value otherwise. Note that a non‐zero return value is returned if either `comment` contains `‐‐` or if `omitEnclosingWhitespace` is `true` and `comment` ends with `‐`. Also note that if an element‐opening tag is not completed with a `>`, `addValidComment` will add `>`. == Synopsis Declared in `<balxml_formatter.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- int addValidComment( std::string_view const& comment, bool forceNewline = true, bool omitEnclosingWhitespace = false); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#