1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2024-11-10 00:45:36 +00:00

XmlReader: more safety

This commit is contained in:
Antonin Portelli 2014-04-03 10:04:34 +02:00
parent 9a415017c8
commit 0ae8adc013

View File

@ -64,19 +64,22 @@ T XmlReader::getFirstValue(const std::string &nodeName, Strs... nodeNames)
{
LATAN_ERROR(Io, "no XML file opened");
}
//std::cout << "root: " << name[i] << " ";
for (unsigned int i = 0; i < nName; ++i)
{
//std::cout << i << ": " << name[i] << " ";
node = node->FirstChildElement(name[i].c_str());
// std::cout <<
if (!node)
{
LATAN_ERROR(Parsing, "XML node " + name[i] + " not found");
}
}
return strTo<T>(node->GetText());
if (node->GetText())
{
return strTo<T>(node->GetText());
}
else
{
return T();
}
}
END_NAMESPACE