diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2016-11-09 09:11:30 -0800 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2016-11-09 09:11:30 -0800 |
commit | cd7e0b04f6851490c46d1a038764a9a7f44af232 (patch) | |
tree | bdc1da868bf662a123d5b56981ef7c21af50373d /src/pugixml.cpp | |
parent | c75e3c45e5de50a426bc248a68275ae971935438 (diff) |
Add format_no_empty_element_tags flag
Setting this flag outputs start and end tag for every element, including empty
elements.
Fixes #118.
Diffstat (limited to 'src/pugixml.cpp')
-rw-r--r-- | src/pugixml.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 7b96d34..dc3e7be 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -4078,12 +4078,23 @@ PUGI__NS_BEGIN { if (!node->first_child) { - if ((flags & format_raw) == 0) - writer.write(' '); + if (flags & format_no_empty_element_tags) + { + writer.write('>', '<', '/'); + writer.write_string(name); + writer.write('>'); + + return false; + } + else + { + if ((flags & format_raw) == 0) + writer.write(' '); - writer.write('/', '>'); + writer.write('/', '>'); - return false; + return false; + } } else { |