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 b722899
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")
{
const std::string child_name = node->FirstChildElement()->Name();
if (child_name != "Condition")
{
ThrowError(line_number,
std::string("The first child of a ReactiveSequence must be of Condition type"));
}
}
if(children_count == 0)
{
ThrowError(line_number,
Expand Down

0 comments on commit b722899

Please sign in to comment.