further improve the reporting of unprocessed nodes and attributes - refs #1441

This commit is contained in:
Dane Springmeyer 2012-08-23 14:11:25 -07:00
parent 03860b1728
commit 1ca4bcf78d

View file

@ -1636,14 +1636,14 @@ void map_parser::find_unused_nodes(xml_node const& root)
find_unused_nodes_recursive(root, error_message); find_unused_nodes_recursive(root, error_message);
if (!error_message.str().empty()) if (!error_message.str().empty())
{ {
std::string msg("The following nodes or attributes were not processed while parsing the xml file:" + error_message.str()); std::string msg("Unable to process some data while parsing '" + filename_ + "':" + error_message.str());
if (strict_) if (strict_)
{ {
throw config_error(msg); throw config_error(msg);
} }
else else
{ {
MAPNIK_LOG_ERROR(load_map) << "map_parser: " << msg; MAPNIK_LOG_ERROR(load_map) << msg;
} }
} }
} }
@ -1655,7 +1655,7 @@ void map_parser::find_unused_nodes_recursive(xml_node const& node, std::stringst
if (node.is_text()) { if (node.is_text()) {
error_message << "\n* text '" << node.text() << "'"; error_message << "\n* text '" << node.text() << "'";
} else { } else {
error_message << "\n* node '" << node.name() << "' in line " << node.line(); error_message << "\n* node '" << node.name() << "' at line " << node.line();
} }
return; //All attributes and children are automatically unprocessed, too. return; //All attributes and children are automatically unprocessed, too.
} }
@ -1668,7 +1668,7 @@ void map_parser::find_unused_nodes_recursive(xml_node const& node, std::stringst
{ {
error_message << "\n* attribute '" << aitr->first << error_message << "\n* attribute '" << aitr->first <<
"' with value '" << aitr->second.value << "' with value '" << aitr->second.value <<
"' in line " << node.line(); "' at line " << node.line();
} }
} }
xml_node::const_iterator itr = node.begin(); xml_node::const_iterator itr = node.begin();