Class XmlWriter

Nested Relationships

Nested Types

Class Documentation

class XmlWriter

Public Functions

XmlWriter(std::ostream &os)
~XmlWriter()
XmlWriter(XmlWriter const&) = delete
XmlWriter &operator=(XmlWriter const&) = delete
XmlWriter &startElement(std::string const &name, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent)
ScopedElement scopedElement(std::string const &name, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent)
XmlWriter &endElement(XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent)
XmlWriter &writeAttribute(StringRef name, StringRef attribute)

The attribute content is XML-encoded.

XmlWriter &writeAttribute(StringRef name, bool attribute)

Writes the attribute as “true/false”.

XmlWriter &writeAttribute(StringRef name, char const *attribute)

The attribute content is XML-encoded.

template<typename T, typename = typename std::enable_if_t<!std::is_convertible<T, StringRef>::value>>
inline XmlWriter &writeAttribute(StringRef name, T const &attribute)

The attribute value must provide op<<(ostream&, T). The resulting serialization is XML-encoded

XmlWriter &writeText(StringRef text, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent)

Writes escaped text in a element.

XmlWriter &writeComment(StringRef text, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent)

Writes XML comment as “<!– text –>”.

void writeStylesheetRef(StringRef url)
void ensureTagClosed()
class ScopedElement

Public Functions

ScopedElement(XmlWriter *writer, XmlFormatting fmt)
ScopedElement(ScopedElement &&other) noexcept
ScopedElement &operator=(ScopedElement &&other) noexcept
~ScopedElement()
ScopedElement &writeText(StringRef text, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent)
ScopedElement &writeAttribute(StringRef name, StringRef attribute)
template<typename T, typename = typename std::enable_if_t<!std::is_convertible<T, StringRef>::value>>
inline ScopedElement &writeAttribute(StringRef name, T const &attribute)