Remove multiple consecutive empty <xmltext> nodes.
This commit is contained in:
parent
dccaff73d9
commit
99a3c9fec9
1 changed files with 5 additions and 1 deletions
|
@ -136,19 +136,23 @@ void remove_empty_text_nodes(ptree &pt)
|
||||||
{
|
{
|
||||||
ptree::iterator itr = pt.begin();
|
ptree::iterator itr = pt.begin();
|
||||||
ptree::iterator end = pt.end();
|
ptree::iterator end = pt.end();
|
||||||
for (;itr!=end; itr++)
|
while (itr!=end)
|
||||||
{
|
{
|
||||||
if (itr->first == "<xmltext>") {
|
if (itr->first == "<xmltext>") {
|
||||||
std::string trimmed = boost::algorithm::trim_copy(itr->second.data());
|
std::string trimmed = boost::algorithm::trim_copy(itr->second.data());
|
||||||
if (trimmed.empty()) {
|
if (trimmed.empty()) {
|
||||||
itr = pt.erase(itr);
|
itr = pt.erase(itr);
|
||||||
|
} else {
|
||||||
|
itr++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
remove_empty_text_nodes(itr->second);
|
remove_empty_text_nodes(itr->second);
|
||||||
|
itr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#include <mapnik/internal/dump_xml.hpp>
|
||||||
void load_map(Map & map, std::string const& filename, bool strict)
|
void load_map(Map & map, std::string const& filename, bool strict)
|
||||||
{
|
{
|
||||||
ptree pt;
|
ptree pt;
|
||||||
|
|
Loading…
Reference in a new issue