Trim whitespace in rapidxml parser text nodes.

The libxml parser already trims text nodes, which leads to a
difference in behaviour when reading map style XML. This patch
normalises the behaviour between the two.
This commit is contained in:
Matt Amos 2015-05-31 01:42:02 +01:00
parent 8e1e5f19d1
commit 5616d406b4

View file

@ -138,7 +138,11 @@ private:
{
if (cur_node->value_size() > 0) // Don't add empty text nodes
{
node.add_child(cur_node->value(), 0, true);
// parsed text values should have leading and trailing
// whitespace trimmed.
std::string trimmed = cur_node->value();
mapnik::util::trim(trimmed);
node.add_child(trimmed.c_str(), 0, true);
}
}
break;