Skip to content

Commit b722899

Browse files
author
AndyZe
committed
Additional XML verification for Control nodes
1 parent 2bc72fd commit b722899

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/xml_parsing.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,25 @@ void VerifyXML(const std::string& xml_text,
536536
}
537537
else if(search->second == NodeType::CONTROL)
538538
{
539+
if (name == "Sequence" && children_count <= 2)
540+
{
541+
ThrowError(line_number,
542+
std::string("A Sequence node must have 2 or more children"));
543+
}
544+
else if (name == "ReactiveSequence" && children_count <= 2)
545+
{
546+
ThrowError(line_number,
547+
std::string("A ReactiveSequence node must have 2 or more children"));
548+
}
549+
if (name == "ReactiveSequence")
550+
{
551+
const std::string child_name = node->FirstChildElement()->Name();
552+
if (child_name != "Condition")
553+
{
554+
ThrowError(line_number,
555+
std::string("The first child of a ReactiveSequence must be of Condition type"));
556+
}
557+
}
539558
if(children_count == 0)
540559
{
541560
ThrowError(line_number,

0 commit comments

Comments
 (0)