From 8e12e3bee8b6f94342ab2e1bc99bf2085b2a87dd Mon Sep 17 00:00:00 2001 From: AndyZe Date: Wed, 20 Nov 2024 13:38:03 -0600 Subject: [PATCH] Additional XML verification for Control nodes --- src/xml_parsing.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/xml_parsing.cpp b/src/xml_parsing.cpp index 32a1e42ab..6c1fee60c 100644 --- a/src/xml_parsing.cpp +++ b/src/xml_parsing.cpp @@ -536,6 +536,25 @@ void VerifyXML(const std::string& xml_text, } else if(search->second == NodeType::CONTROL) { + if (name == "Sequence" && children_count <= 2) + { + ThrowError(line_number, + std::string("A Sequence node must have 2 or more children")); + } + else if (name == "ReactiveSequence" && children_count <= 2) + { + ThrowError(line_number, + std::string("A ReactiveSequence node must have 2 or more children")); + } + if (name == "ReactiveSequence") + { + auto first_child_node = search->second.FirstChildElement(); + if (first_child_node != NodeType::CONDITION) + { + ThrowError(line_number, + std::string("The first child of a ReactiveSequence should be of Condition type")); + } + } if(children_count == 0) { ThrowError(line_number,