|
32 | 32 |
|
33 | 33 | #ifdef HAVE_RULES |
34 | 34 | // xml is used in rules |
35 | | -#include <tinyxml.h> |
| 35 | +#include <tinyxml2.h> |
36 | 36 | #endif |
37 | 37 |
|
38 | 38 | static void AddFilesToList(const std::string& FileList, std::vector<std::string>& PathNames) |
@@ -587,28 +587,28 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) |
587 | 587 |
|
588 | 588 | // Rule file |
589 | 589 | else if (std::strncmp(argv[i], "--rule-file=", 12) == 0) { |
590 | | - TiXmlDocument doc; |
591 | | - if (doc.LoadFile(12+argv[i])) { |
592 | | - TiXmlElement *node = doc.FirstChildElement(); |
593 | | - for (; node && node->ValueStr() == "rule"; node = node->NextSiblingElement()) { |
| 590 | + tinyxml2::XMLDocument doc; |
| 591 | + if (doc.LoadFile(12+argv[i]) == tinyxml2::XML_NO_ERROR) { |
| 592 | + tinyxml2::XMLElement *node = doc.FirstChildElement(); |
| 593 | + for (; node && strcmp(node->Value(), "rule") == 0; node = node->NextSiblingElement()) { |
594 | 594 | Settings::Rule rule; |
595 | 595 |
|
596 | | - TiXmlElement *pattern = node->FirstChildElement("pattern"); |
| 596 | + tinyxml2::XMLElement *pattern = node->FirstChildElement("pattern"); |
597 | 597 | if (pattern) { |
598 | 598 | rule.pattern = pattern->GetText(); |
599 | 599 | } |
600 | 600 |
|
601 | | - TiXmlElement *message = node->FirstChildElement("message"); |
| 601 | + tinyxml2::XMLElement *message = node->FirstChildElement("message"); |
602 | 602 | if (message) { |
603 | | - TiXmlElement *severity = message->FirstChildElement("severity"); |
| 603 | + tinyxml2::XMLElement *severity = message->FirstChildElement("severity"); |
604 | 604 | if (severity) |
605 | 605 | rule.severity = severity->GetText(); |
606 | 606 |
|
607 | | - TiXmlElement *id = message->FirstChildElement("id"); |
| 607 | + tinyxml2::XMLElement *id = message->FirstChildElement("id"); |
608 | 608 | if (id) |
609 | 609 | rule.id = id->GetText(); |
610 | 610 |
|
611 | | - TiXmlElement *summary = message->FirstChildElement("summary"); |
| 611 | + tinyxml2::XMLElement *summary = message->FirstChildElement("summary"); |
612 | 612 | if (summary) |
613 | 613 | rule.summary = summary->GetText(); |
614 | 614 | } |
|
0 commit comments