Skip to content

Commit

Permalink
Additional XML verification for Control nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyZe committed Nov 20, 2024
1 parent 2bc72fd commit 8e12e3b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/xml_parsing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 8e12e3b

Please sign in to comment.