diff options
| author | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-10-19 15:38:10 +0000 | 
|---|---|---|
| committer | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-10-19 15:38:10 +0000 | 
| commit | a18385e1e09794f8ed46d99883e1e00bf554f69a (patch) | |
| tree | 4439a55ad6ee9fdd258c9832b813ca9db276f804 /src | |
| parent | b979d4c2bd1e8f445befd53ea8357b594f1ca3b2 (diff) | |
If an element node has the only child, and it is of CDATA type, then the extra indentation is omitted (previously this behavior only held for PCDATA children)
git-svn-id: http://pugixml.googlecode.com/svn/trunk@770 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'src')
| -rw-r--r-- | src/pugixml.cpp | 7 | 
1 files changed, 5 insertions, 2 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 241eaed..e24ba3c 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -2920,11 +2920,14 @@ namespace  			}  			else if (!node.first_child())  				writer.write(' ', '/', '>', '\n'); -			else if (node.first_child() == node.last_child() && node.first_child().type() == node_pcdata) +			else if (node.first_child() == node.last_child() && (node.first_child().type() == node_pcdata || node.first_child().type() == node_cdata))  			{  				writer.write('>'); -				text_output_escaped(writer, node.first_child().value(), ctx_special_pcdata); +                if (node.first_child().type() == node_pcdata) +                    text_output_escaped(writer, node.first_child().value(), ctx_special_pcdata); +                else +                    text_output_cdata(writer, node.first_child().value());  				writer.write('<', '/');  				writer.write(name);  | 
