diff --git a/include/mapnik/xml_node.hpp b/include/mapnik/xml_node.hpp index f0db516e1..82c8ded0b 100644 --- a/include/mapnik/xml_node.hpp +++ b/include/mapnik/xml_node.hpp @@ -51,7 +51,7 @@ public: class node_not_found: public std::exception { public: - node_not_found(std::string node_name); + node_not_found(std::string const& node_name); virtual const char* what() const throw(); ~node_not_found() throw (); private: @@ -84,7 +84,7 @@ class xml_node public: typedef std::list::const_iterator const_iterator; typedef std::map attribute_map; - xml_node(xml_tree &tree, std::string name, unsigned line=0, bool text_node = false); + xml_node(xml_tree &tree, std::string const& name, unsigned line=0, bool text_node = false); std::string const& name() const; std::string const& text() const; diff --git a/src/libxml2_loader.cpp b/src/libxml2_loader.cpp index d95e145ca..31b235cb6 100644 --- a/src/libxml2_loader.cpp +++ b/src/libxml2_loader.cpp @@ -185,7 +185,8 @@ private: break; case XML_TEXT_NODE: { - std::string trimmed = boost::algorithm::trim_copy(std::string((char*)cur_node->content)); + std::string trimmed((char*)cur_node->content); + boost::algorithm::trim(trimmed); if (trimmed.empty()) break; //Don't add empty text nodes node.add_child(trimmed, cur_node->line, true); } diff --git a/src/xml_tree.cpp b/src/xml_tree.cpp index 940832782..26c3a3bf7 100644 --- a/src/xml_tree.cpp +++ b/src/xml_tree.cpp @@ -200,7 +200,7 @@ xml_attribute::xml_attribute(std::string const& value_) /****************************************************************************/ -node_not_found::node_not_found(std::string node_name) +node_not_found::node_not_found(std::string const& node_name) : node_name_(node_name) { @@ -255,7 +255,7 @@ more_than_one_child::~more_than_one_child() throw() /****************************************************************************/ -xml_node::xml_node(xml_tree &tree, std::string name, unsigned line, bool text_node) +xml_node::xml_node(xml_tree &tree, std::string const& name, unsigned line, bool text_node) : tree_(tree), name_(name), text_node_(text_node),