Suppressions: Better XML formatting
This commit is contained in:
parent
a2b8eb7405
commit
87557afc43
|
@ -77,10 +77,14 @@ std::string Suppressions::parseXmlFile(const char *filename)
|
|||
tinyxml2::XMLError error = doc.LoadFile(filename);
|
||||
if (error == tinyxml2::XML_ERROR_FILE_NOT_FOUND)
|
||||
return "File not found";
|
||||
if (error != tinyxml2::XML_SUCCESS)
|
||||
return "Failed to parse XML file";
|
||||
|
||||
const tinyxml2::XMLElement * const rootnode = doc.FirstChildElement();
|
||||
for (const tinyxml2::XMLElement * e = rootnode->FirstChildElement(); e; e = e->NextSiblingElement()) {
|
||||
if (std::strcmp(e->Name(), "suppress") == 0) {
|
||||
if (std::strcmp(e->Name(), "suppress") != 0)
|
||||
return "Invalid suppression xml file format, expected <suppress> element but got a <" + std::string(e->Name()) + '>';
|
||||
|
||||
Suppression s;
|
||||
for (const tinyxml2::XMLElement * e2 = e->FirstChildElement(); e2; e2 = e2->NextSiblingElement()) {
|
||||
const char *text = e2->GetText() ? e2->GetText() : "";
|
||||
|
@ -93,13 +97,13 @@ std::string Suppressions::parseXmlFile(const char *filename)
|
|||
else if (std::strcmp(e2->Name(), "symbolName") == 0)
|
||||
s.symbolName = text;
|
||||
else
|
||||
return std::string("Unknown suppression element '") + e2->Name() + "'";
|
||||
return "Unknown suppression element <" + std::string(e2->Name()) + ">, expected <id>/<fileName>/<lineNumber>/<symbolName>";
|
||||
}
|
||||
|
||||
const std::string err = addSuppression(s);
|
||||
if (!err.empty())
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue