![]() |
zeep::xml::document
// In header: <zeep/xml/document.hpp> class document : public zeep::xml::element { public: // member classes/structs/unions struct notation { // public data members std::string m_name; std::string m_sysid; std::string m_pubid; }; // construct/copy/destruct document(); document(const document &); document(document &&); document(const std::string &); document(std::istream &); document(std::istream &, const std::string &); document & operator=(const document &); document & operator=(document &&); ~document(); // public member functions bool is_validating() const; void set_validating(bool); bool is_validating_ns() const; void set_validating_ns(bool); bool preserves_cdata() const; void set_preserve_cdata(bool); bool collapses_empty_tags() const; void set_collapse_empty_tags(bool); bool write_html() const; void set_write_html(bool); bool suppresses_comments() const; void set_suppress_comments(bool); bool escapes_white_space() const; void set_escape_white_space(bool); bool escapes_double_quote() const; void set_escape_double_quote(bool); bool wraps_prolog() const; void set_wrap_prolog(bool); doc_type get_doctype() const; void set_doctype(const std::string &, const std::string &, const std::string &); void set_doctype(const doc_type &); bool writes_xml_decl() const; void set_write_xml_decl(bool); bool writes_doctype() const; void set_write_doctype(bool); bool is_html5() const; template<typename T> void serialize(const char *, const T &); template<typename T> void deserialize(const char *, T &); bool operator==(const document &) const; bool operator!=(const document &) const; void set_base_dir(const std::string &); template<typename Callback> void set_entity_loader(Callback &&); encoding_type get_encoding() const; void set_encoding(encoding_type); float get_version() const; void set_version(float); virtual element * root(); virtual const element * root() const; virtual node * child(); virtual const node * child() const; // friend functions friend std::ostream & operator<<(std::ostream &, const document &); friend std::istream & operator>>(std::istream &, document &); // protected member functions virtual node_iterator insert_impl(const_iterator, node *); void XmlDeclHandler(encoding_type, bool, float); void StartElementHandler(const std::string &, const std::string &, const parser::attr_list_type &); void EndElementHandler(const std::string &, const std::string &); void CharacterDataHandler(const std::string &); void ProcessingInstructionHandler(const std::string &, const std::string &); void CommentHandler(const std::string &); void StartCdataSectionHandler(); void EndCdataSectionHandler(); void StartNamespaceDeclHandler(const std::string &, const std::string &); void EndNamespaceDeclHandler(const std::string &); void DoctypeDeclHandler(const std::string &, const std::string &, const std::string &); void NotationDeclHandler(const std::string &, const std::string &, const std::string &); std::istream * external_entity_ref(const std::string &, const std::string &, const std::string &); void parse(std::istream &); virtual void write(std::ostream &, format_info) const; };
document
public
construct/copy/destructdocument();Constructor for an empty document.
document(const document & doc);Copy constructor.
document(document && other);Move constructor.
document(const std::string & s);Constructor that will parse the XML passed in argument using default settings s.
document(std::istream & is);Constructor that will parse the XML passed in argument using default settings is.
document(std::istream & is, const std::string & base_dir);Constructor that will parse the XML passed in argument is. This constructor will also validate the input using DTD's found in base_dir.
document & operator=(const document & doc);Copy operator=.
document & operator=(document && other);Move operator=.
~document();
document
public member functionsbool is_validating() const;
options for parsing validating uses a DTD if it is defined
void set_validating(bool validate);
bool is_validating_ns() const;validating_ns: when validating take the NS 1.0 specification into account
void set_validating_ns(bool validate);
bool preserves_cdata() const;
preserve cdata, preserves CDATA sections instead of converting them into text nodes.
void set_preserve_cdata(bool p);if p is true, the CDATA sections will be preserved when parsing XML, if p is false, the content of the CDATA will be treated as text
bool collapses_empty_tags() const;collapse means replacing e.g.
<foo></foo>
with <foo/>
void set_collapse_empty_tags(bool c);if c is true, empty tags will be replaced, i.e. write
<foo/>
instead of <foo></foo>
bool write_html() const;collapse 'empty elements' according to HTML rules
void set_write_html(bool f);if c is true, 'empty elements' will be collapsed according to HTML rules
bool suppresses_comments() const;whether to write out comments
void set_suppress_comments(bool s);if s is true, comments will not be written
bool escapes_white_space() const;whether to escape white space
void set_escape_white_space(bool e);if e is true, white space will be written as XML entities
bool escapes_double_quote() const;whether to escape double quotes
void set_escape_double_quote(bool e);if e is true, double quotes will be written as "
bool wraps_prolog() const;whether to place a newline after a prolog
void set_wrap_prolog(bool w);if w is true, a newline will be written after the XML prolog
doc_type get_doctype() const;Get the doctype as parsed.
void set_doctype(const std::string & root, const std::string & pubid, const std::string & dtd);Set the doctype to write out.
void set_doctype(const doc_type & doctype);Set the doctype to write out.
bool writes_xml_decl() const;whether to write a XML prolog
void set_write_xml_decl(bool w);if w is true, an XML prolog will be written
bool writes_doctype() const;whether to write a DOCTYPE
void set_write_doctype(bool f);if f is true a DOCTYPE will be written
bool is_html5() const;Check the doctype to see if this is supposed to be HTML5.
template<typename T> void serialize(const char * name, const T & data);Serialization support.
Serialize data into a document containing name as root node
template<typename T> void deserialize(const char * name, T & data);Serialization support.
Deserialize root node with name name into data.
bool operator==(const document & doc) const;Compare two xml documents.
bool operator!=(const document & doc) const;
void set_base_dir(const std::string & path);
If you want to validate the document using DTD files stored on disk, you can specifiy this directory prior to reading the document.
template<typename Callback> void set_entity_loader(Callback && cb);
If you want to be able to load external documents other than trying to read them from disk you can set a callback here.
encoding_type get_encoding() const;The text encoding as detected in the input.
void set_encoding(encoding_type enc);The text encoding to use for output.
float get_version() const;XML version, should be either 1.0 or 1.1.
void set_version(float v);XML version, should be either 1.0 or 1.1.
virtual element * root();The root node for this node.
virtual const element * root() const;The root node for this node.
virtual node * child();
virtual const node * child() const;
document
protected member functionsvirtual node_iterator insert_impl(const_iterator pos, node * n);
void XmlDeclHandler(encoding_type encoding, bool standalone, float version);
void StartElementHandler(const std::string & name, const std::string & uri, const parser::attr_list_type & atts);
void EndElementHandler(const std::string & name, const std::string & uri);
void CharacterDataHandler(const std::string & data);
void ProcessingInstructionHandler(const std::string & target, const std::string & data);
void CommentHandler(const std::string & comment);
void StartCdataSectionHandler();
void EndCdataSectionHandler();
void StartNamespaceDeclHandler(const std::string & prefix, const std::string & uri);
void EndNamespaceDeclHandler(const std::string & prefix);
void DoctypeDeclHandler(const std::string & root, const std::string & publicId, const std::string & uri);
void NotationDeclHandler(const std::string & name, const std::string & sysid, const std::string & pubid);
std::istream * external_entity_ref(const std::string & base, const std::string & pubid, const std::string & sysid);
void parse(std::istream & data);
virtual void write(std::ostream & os, format_info fmt) const;low level routine for writing out XML
This method is usually called by operator<<(std::ostream&, zeep::xml::document&)