diff --git a/docs/manual.adoc b/docs/manual.adoc index 9600bcf..6294606 100644 --- a/docs/manual.adoc +++ b/docs/manual.adoc @@ -1704,6 +1704,8 @@ These flags control the resulting tree contents: * [[format_no_empty_element_tags]]`format_no_empty_element_tags` determines if start/end tags should be output instead of empty element tags for empty elements (that is, elements with no children). This flag is *off* by default. +* [[format_skip_control_chars]]`format_skip_control_chars` enables skipping characters belonging to range [0; 32) instead of "&#xNN;" encoding. This flag is *off* by default. + These flags control the additional output information: * [[format_no_declaration]]`format_no_declaration` disables default node declaration output. By default, if the document is saved via `save` or `save_file` function, and it does not have any document declaration, a default declaration is output before the document contents. Enabling this flag disables this declaration. This flag has no effect in `xml_node::print` functions: they never output the default declaration. This flag is *off* by default. @@ -2659,6 +2661,7 @@ const unsigned int +++format_no_empty_el const unsigned int +++format_no_escapes+++ const unsigned int +++format_raw+++ const unsigned int +++format_save_file_text+++ +const unsigned int +++format_skip_control_chars+++ const unsigned int +++format_write_bom+++ // Parsing options bit flags: diff --git a/tests/test_control_chars.cpp b/tests/test_control_chars.cpp new file mode 100644 index 0000000..589f380 --- /dev/null +++ b/tests/test_control_chars.cpp @@ -0,0 +1,9 @@ +#include "test.hpp" + +TEST_XML(control_chars_skip, "\f\t\n\x0F\x19") { + CHECK_NODE_EX(doc.first_child(), STR("\t\n\n"), STR(""), pugi::format_default | pugi::format_skip_control_chars); +} + +TEST_XML(control_chars_keep, "\f\t\n\x0F\x19") { + CHECK_NODE_EX(doc.first_child(), STR(" \t\n\n"), STR(""), pugi::format_default); +}