From 6610fcc2973a437527fa279a73a5ba4041585a28 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Fri, 23 May 2014 10:27:37 -0700 Subject: [PATCH] fix skipping of empty text nodes in rapidxml parser (matches libxml2) - closes #2253 --- src/rapidxml_loader.cpp | 5 ++++- tests/data/good_maps/empty_text_symbolizer.xml | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 tests/data/good_maps/empty_text_symbolizer.xml diff --git a/src/rapidxml_loader.cpp b/src/rapidxml_loader.cpp index a11064f3e..016068fa2 100644 --- a/src/rapidxml_loader.cpp +++ b/src/rapidxml_loader.cpp @@ -141,7 +141,10 @@ private: case rapidxml::node_data: case rapidxml::node_cdata: { - node.add_child(cur_node->value(), 0, true); + if (cur_node->value_size() > 0) // Don't add empty text nodes + { + node.add_child(cur_node->value(), 0, true); + } } break; default: diff --git a/tests/data/good_maps/empty_text_symbolizer.xml b/tests/data/good_maps/empty_text_symbolizer.xml new file mode 100644 index 000000000..1582583ee --- /dev/null +++ b/tests/data/good_maps/empty_text_symbolizer.xml @@ -0,0 +1,15 @@ + + + + + + labels + + + \ No newline at end of file