diff --git a/docs/manual.adoc b/docs/manual.adoc index 5974808..0262047 100644 --- a/docs/manual.adoc +++ b/docs/manual.adoc @@ -1604,12 +1604,12 @@ bool xml_document::save_file(const char* path, const char_t* indent = "\t", unsi bool xml_document::save_file(const wchar_t* path, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const; ---- -These functions accept file path as its first argument, and also three optional arguments, which specify indentation and other output options (see <>) and output data encoding (see <>). The path has the target operating system format, so it can be a relative or absolute one, it should have the delimiters of the target system, it should have the exact case if the target file system is case-sensitive, etc. +These functions accept file path as its first argument, and also three optional arguments, which specify indentation and other output options (see <>) and output data encoding (see <>). The path has the target operating system format, so it can be a relative or absolute one, it should have the delimiters of the target system, it should have the exact case if the target file system is case-sensitive, etc. The functions return `true` on success and `false` if the file could not be opened or written to. File path is passed to the system file opening function as is in case of the first function (which accepts `const char* path`); the second function either uses a special file opening function if it is provided by the runtime library or converts the path to UTF-8 and uses the system file opening function. [[xml_writer_file]] -`save_file` opens the target file for writing, outputs the requested header (by default a document declaration is output, unless the document already has one), and then saves the document contents. If the file could not be opened, the function returns `false`. Calling `save_file` is equivalent to creating an `xml_writer_file` object with `FILE*` handle as the only constructor argument and then calling `save`; see <> for writer interface details. +`save_file` opens the target file for writing, outputs the requested header (by default a document declaration is output, unless the document already has one), and then saves the document contents. Calling `save_file` is equivalent to creating an `xml_writer_file` object with `FILE*` handle as the only constructor argument and then calling `save`; see <> for writer interface details. This is a simple example of saving XML document to file (link:samples/save_file.cpp[]): diff --git a/docs/manual.html b/docs/manual.html index 0811f0a..0cec877 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -1571,14 +1571,14 @@ Sometimes XML data should be loaded from some other source than a file, i.e. HTT
-
struct xml_parse_result
+
struct xml_parse_result
 {
     xml_parse_status status;
     ptrdiff_t offset;
     xml_encoding encoding;
 
     operator bool() const;
-    const char* description() const;
+    const char* description() const;
 };
@@ -2276,8 +2276,8 @@ Node and attribute iterators are somewhere in the middle between const and non-c { public: virtual bool begin(xml_node& node); - virtual bool for_each(xml_node& node) = 0; - virtual bool end(xml_node& node); + virtual bool for_each(xml_node& node) = 0; + virtual bool end(xml_node& node); int depth() const; }; @@ -2313,7 +2313,7 @@ The traversal is launched by calling traverse function on traversal
-
struct simple_walker: pugi::xml_tree_walker
+
struct simple_walker: pugi::xml_tree_walker
 {
     virtual bool for_each(pugi::xml_node& node)
     {
@@ -2341,9 +2341,9 @@ While there are existing functions for getting a node/attribute with known conte
 
-
template <typename Predicate> xml_attribute xml_node::find_attribute(Predicate pred) const;
-template <typename Predicate> xml_node xml_node::find_child(Predicate pred) const;
-template <typename Predicate> xml_node xml_node::find_node(Predicate pred) const;
+
template <typename Predicate> xml_attribute xml_node::find_attribute(Predicate pred) const;
+template <typename Predicate> xml_node xml_node::find_child(Predicate pred) const;
+template <typename Predicate> xml_node xml_node::find_node(Predicate pred) const;
@@ -2368,14 +2368,14 @@ While there are existing functions for getting a node/attribute with known conte return node.attribute("Timeout").as_int() < 20; } -struct allow_remote_predicate +struct allow_remote_predicate { - bool operator()(pugi::xml_attribute attr) const + bool operator()(pugi::xml_attribute attr) const { return strcmp(attr.name(), "AllowRemote") == 0; } - bool operator()(pugi::xml_node node) const + bool operator()(pugi::xml_node node) const { return node.attribute("AllowRemote").as_bool(); } @@ -3120,13 +3120,13 @@ If you want to save the whole document to a file, you can use one of the followi
-

These functions accept file path as its first argument, and also three optional arguments, which specify indentation and other output options (see Output options) and output data encoding (see Encodings). The path has the target operating system format, so it can be a relative or absolute one, it should have the delimiters of the target system, it should have the exact case if the target file system is case-sensitive, etc.

+

These functions accept file path as its first argument, and also three optional arguments, which specify indentation and other output options (see Output options) and output data encoding (see Encodings). The path has the target operating system format, so it can be a relative or absolute one, it should have the delimiters of the target system, it should have the exact case if the target file system is case-sensitive, etc. The functions return true on success and false if the file could not be opened or written to.

File path is passed to the system file opening function as is in case of the first function (which accepts const char* path); the second function either uses a special file opening function if it is provided by the runtime library or converts the path to UTF-8 and uses the system file opening function.

-

save_file opens the target file for writing, outputs the requested header (by default a document declaration is output, unless the document already has one), and then saves the document contents. If the file could not be opened, the function returns false. Calling save_file is equivalent to creating an xml_writer_file object with FILE* handle as the only constructor argument and then calling save; see Saving document via writer interface for writer interface details.

+

save_file opens the target file for writing, outputs the requested header (by default a document declaration is output, unless the document already has one), and then saves the document contents. Calling save_file is equivalent to creating an xml_writer_file object with FILE* handle as the only constructor argument and then calling save; see Saving document via writer interface for writer interface details.

This is a simple example of saving XML document to file (samples/save_file.cpp):

@@ -3194,11 +3194,11 @@ All of the above saving functions are implemented in terms of writer interface.
-
struct xml_string_writer: pugi::xml_writer
+
struct xml_string_writer: pugi::xml_writer
 {
     std::string result;
 
-    virtual void write(const void* data, size_t size)
+    virtual void write(const void* data, size_t size)
     {
         result.append(static_cast<const char*>(data), size);
     }
@@ -3509,7 +3509,7 @@ The order of iteration depends on the order of nodes inside the set; the order c
 
-
enum xpath_node_set::type_t {type_unsorted, type_sorted, type_sorted_reverse};
+
enum xpath_node_set::type_t {type_unsorted, type_sorted, type_sorted_reverse};
 type_t xpath_node_set::type() const;
@@ -3896,13 +3896,13 @@ If exceptions are disabled, then in the event of parsing failure the query is in
-
struct xpath_parse_result
+
struct xpath_parse_result
 {
     const char* error;
     ptrdiff_t offset;
 
     operator bool() const;
-    const char* description() const;
+    const char* description() const;
 };
@@ -5604,9 +5604,9 @@ If exceptions are disabled, then in the event of parsing failure the query is in bool traverse(xml_tree_walker& walker); - template <typename Predicate> xml_attribute find_attribute(Predicate pred) const; - template <typename Predicate> xml_node find_child(Predicate pred) const; - template <typename Predicate> xml_node find_node(Predicate pred) const; + template <typename Predicate> xml_attribute find_attribute(Predicate pred) const; + template <typename Predicate> xml_node find_child(Predicate pred) const; + template <typename Predicate> xml_node find_node(Predicate pred) const; string_t path(char_t delimiter = '/') const; xml_node xml_node::first_element_by_path(const char_t* path, char_t delimiter = '/') const; @@ -5815,7 +5815,7 @@ If exceptions are disabled, then in the event of parsing failure the query is in xpath_node first() const; - enum type_t {type_unsorted, type_sorted, type_sorted_reverse}; + enum type_t {type_unsorted, type_sorted, type_sorted_reverse}; type_t type() const; void sort(bool reverse = false); @@ -5871,12 +5871,17 @@ If exceptions are disabled, then in the event of parsing failure the query is in