zeep::xml::writer — Use xml::writer to write XML documents to a stream.
// In header: </home/maarten/projects/libzeep/zeep/xml/writer.hpp> class writer { public: // construct/copy/destruct writer(std::ostream &); writer(std::ostream &, bool, bool = false); ~writer(); // public member functions void set_xml_decl(bool); void set_indent(int); void set_wrap(bool); void set_wrap_prolog(bool); void set_trim(bool); void set_collapse_empty_elements(bool); void set_escape_whitespace(bool); void set_no_comment(bool); void xml_decl(bool); void empty_doctype(const std::string &, const std::string &); void doctype(const std::string &, const std::string &, const std::string &); void start_doctype(const std::string &, const std::string &); void notation(const std::string &, const std::string &, const std::string &); void end_doctype(); void start_element(const std::string &); void end_element(); void attribute(const std::string &, const std::string &); void content(const std::string &); void element(const std::string &, const std::string &); void cdata(const std::string &); void comment(const std::string &); void processing_instruction(const std::string &, const std::string &); };
The zeep::xml::writer class is used to write XML documents. It has several options that influence the way the data is written. E.g. it is possible to specify whether to wrap the elements and what indentation to use. The writer keeps track of opened elements and therefore knows how to close an element.
The writer writes out XML 1.0 files.
writer
public member functionsvoid set_xml_decl(bool flag);set_encoding is not yet implemented, we only support UTF-8 for now
the xml declaration flag (<?xml version...) is not written by default
void set_indent(int indentation);the indentation in number of spaces, default is two.
void set_wrap(bool flag);default is to wrap XML files
void set_wrap_prolog(bool flag);default is to wrap XML files
void set_trim(bool flag);if the trim flag is set, all whitespace will be trimmed to one space exactly
void set_collapse_empty_elements(bool collapse);collapsing empty elements (<empyt>) is the default behaviour
void set_escape_whitespace(bool escape);escape whitespace into character refences can be specified.
void set_no_comment(bool no_comment);do not write out comments
void xml_decl(bool standalone);write a xml declaration, version will be 1.0, standalone can be specified.
void empty_doctype(const std::string & root, const std::string & dtd);To write an empty DOCTYPE specifying an external subset.
void doctype(const std::string & root, const std::string & pubid, const std::string & dtd);This opens a DOCTYPE declaration. The root parameter is the name of the base element.
void start_doctype(const std::string & root, const std::string & dtd);
void notation(const std::string & name, const std::string & sysid, const std::string & pubid);To write a NOTATION declaration.
void end_doctype();End a DOCTYPE declaration.
void start_element(const std::string & name);
void end_element();
void attribute(const std::string & name, const std::string & value);
void content(const std::string & content);
void element(const std::string & name, const std::string & s);
void cdata(const std::string & text);
void comment(const std::string & text);
void processing_instruction(const std::string & target, const std::string & text);