1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-17 07:17:06 +01:00

minor serial IO fixes, XML now issues warning when trying to read absent nodes, these becomes

This commit is contained in:
2017-12-01 19:44:07 +00:00
parent 25f73018f4
commit 2427a21428
4 changed files with 41 additions and 18 deletions

View File

@ -100,13 +100,16 @@ XmlReader::XmlReader(const string &fileName,string toplev) : fileName_(fileName)
bool XmlReader::push(const string &s)
{
if (node_.child(s.c_str()))
{
node_ = node_.child(s.c_str());
if (node_.child(s.c_str()) == NULL )
return true;
}
else
{
return false;
node_ = node_.child(s.c_str());
return true;
}
}
void XmlReader::pop(void)
@ -117,20 +120,30 @@ void XmlReader::pop(void)
bool XmlReader::nextElement(const std::string &s)
{
if (node_.next_sibling(s.c_str()))
{
node_ = node_.next_sibling(s.c_str());
return true;
}
{
node_ = node_.next_sibling(s.c_str());
return true;
}
else
{
return false;
}
{
return false;
}
}
template <>
void XmlReader::readDefault(const string &s, string &output)
{
output = node_.child(s.c_str()).first_child().value();
if (node_.child(s.c_str()))
{
output = node_.child(s.c_str()).first_child().value();
}
else
{
std::cout << GridLogWarning << "XML: cannot open node '" << s << "'";
std::cout << std::endl;
output = "";
}
}