Add the specified value as the data content of the current element.

Synopsis

Declared in <balxml_formatter.h>

template<class TYPE>
void
addData(
    TYPE const& value,
    int formattingMode = 0);

Description

value can be of the following types: char, short, int, bsls::Types::Int64, float, double, bsl::string, bdlt::Datetime, bdlt::Date, and bdlt::Time. Perform no line‐wrapping or indentation as if the whitespace constraint were always BAEXML_PRESERVE_WHITESPACE in openElement, with the only exception that an initial newline and an initial indent is added when openElement specifies BAEXML_NEWLINE_INDENT option. If value is of type bsl::string or convertible to bsl::string_view, the presence of invalid input stops the transfer of data to the output specified on construction (see {Valid Strings}). If value is of type bsl::string or convertible to bsl::string_view, characters in value are escaped (see {Special Characters}). If value is of type char, it is cast to a signed byte value with a range of [ ‐128 .. 127 ]. Optionally specify the formattingMode to specify the format used to encode value. The behavior is undefined if the call is made when there are no opened elements.

Parameters

Name

Description

value

data content to add

formattingMode

mode used to format value

Created with MrDocs