Skip to content

Commit 73266bf

Browse files
author
Gaël Écorchard
committed
Fix number of children for decorator and sub-tree nodes in XSD
Signed-off-by: Gaël Écorchard <[email protected]>
1 parent a5e01e2 commit 73266bf

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/xml_parsing.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,18 +1359,19 @@ std::string writeTreeXSD(const BehaviorTreeFactory& factory)
13591359
{
13601360
XMLElement* type = doc.NewElement("xs:complexType");
13611361
type->SetAttribute("name", (model->registration_ID + "Type").c_str());
1362-
if ((model->type == NodeType::CONDITION) or (model->type == NodeType::ACTION))
1362+
if ((model->type == NodeType::ACTION)
1363+
or (model->type == NodeType::CONDITION)
1364+
or (model->type == NodeType::SUBTREE))
13631365
{
13641366
/* No children, nothing to add. */
13651367
}
1366-
else if ((model->type == NodeType::DECORATOR)
1367-
or (model->type == NodeType::SUBTREE))
1368+
else if (model->type == NodeType::DECORATOR)
13681369
{
13691370
/* One child. */
1370-
// <xs:group ref="oneNodeGroup" minOccurs="0" maxOccurs="1"/>
1371+
// <xs:group ref="oneNodeGroup" minOccurs="1" maxOccurs="1"/>
13711372
XMLElement* group = doc.NewElement("xs:group");
13721373
group->SetAttribute("ref", "oneNodeGroup");
1373-
group->SetAttribute("minOccurs", "0");
1374+
group->SetAttribute("minOccurs", "1");
13741375
group->SetAttribute("maxOccurs", "1");
13751376
type->InsertEndChild(group);
13761377
}

0 commit comments

Comments
 (0)