From 61435684b2f50a7a5c213ab743bdd13015f506ec Mon Sep 17 00:00:00 2001 From: Raphael Geissert Date: Wed, 2 Feb 2011 09:35:15 -0600 Subject: [PATCH] Support multiple rules in a single XML file --- cli/cmdlineparser.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index 98bcee069..10482e6fc 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -513,18 +513,17 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) TiXmlDocument doc; if (doc.LoadFile(12+argv[i])) { - TiXmlElement *root = doc.FirstChildElement(); - if (root && root->ValueStr() == "rule") - { + TiXmlElement *node = doc.FirstChildElement(); + for (; node && node->ValueStr() == "rule"; node = node->NextSiblingElement()) { Settings::Rule rule; - TiXmlElement *pattern = root->FirstChildElement("pattern"); + TiXmlElement *pattern = node->FirstChildElement("pattern"); if (pattern) { rule.pattern = pattern->GetText(); } - TiXmlElement *message = root->FirstChildElement("message"); + TiXmlElement *message = node->FirstChildElement("message"); if (message) { TiXmlElement *severity = message->FirstChildElement("severity");