@@ -49,6 +49,10 @@ namespace
49
49
std::string
50
50
xsdAttributeType (const BT::PortInfo& port_info)
51
51
{
52
+ if (port_info.direction () == BT::PortDirection::OUTPUT)
53
+ {
54
+ return " blackboardType" ;
55
+ }
52
56
const auto & type_info = port_info.type ();
53
57
if ((type_info == typeid (int )) or (type_info == typeid (unsigned int )))
54
58
{
@@ -60,11 +64,11 @@ xsdAttributeType(const BT::PortInfo& port_info)
60
64
}
61
65
else if (type_info == typeid (bool ))
62
66
{
63
- return " xs:boolean " ;
67
+ return " booleanOrBlackboardType " ;
64
68
}
65
69
else if (type_info == typeid (std::string))
66
70
{
67
- return " xs:string " ;
71
+ return " stringOrBlackboardType " ;
68
72
}
69
73
70
74
return std::string ();
@@ -1201,17 +1205,22 @@ std::string writeTreeXSD(const BehaviorTreeFactory& factory)
1201
1205
1202
1206
// TODO: add <xs:whiteSpace value="preserve"/> for `inputPortType` and `outputPortType`.
1203
1207
parse_and_insert (schema_element, R"(
1204
- <xs:simpleType name="decimalOrBlackboardType ">
1208
+ <xs:simpleType name="blackboardType ">
1205
1209
<xs:restriction base="xs:string">
1206
- <xs:pattern value="[+-]?[0-9]*(\.[0-9]+)?"/>
1207
- <xs:pattern value="\{[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z][a-zA-Z0-9_]*)*\}"/>
1210
+ <xs:pattern value="\{.*\}"/>
1208
1211
</xs:restriction>
1209
1212
</xs:simpleType>
1213
+ <xs:simpleType name="booleanOrBlackboardType">
1214
+ <xs:union memberTypes="xs:boolean blackboardType"/>
1215
+ </xs:simpleType>
1210
1216
<xs:simpleType name="integerOrBlackboardType">
1211
- <xs:restriction base="xs:string">
1212
- <xs:pattern value="[+-]?[0-9]+"/>
1213
- <xs:pattern value="\{[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z][a-zA-Z0-9_]*)*\}"/>
1214
- </xs:restriction>
1217
+ <xs:union memberTypes="xs:integer blackboardType"/>
1218
+ </xs:simpleType>
1219
+ <xs:simpleType name="decimalOrBlackboardType">
1220
+ <xs:union memberTypes="xs:decimal blackboardType"/>
1221
+ </xs:simpleType>
1222
+ <xs:simpleType name="stringOrBlackboardType">
1223
+ <xs:union memberTypes="xs:string blackboardType"/>
1215
1224
</xs:simpleType>
1216
1225
<xs:simpleType name="descriptionType">
1217
1226
<xs:restriction base="xs:string">
@@ -1295,7 +1304,7 @@ std::string writeTreeXSD(const BehaviorTreeFactory& factory)
1295
1304
<xs:element ref="TreeNodesModel" minOccurs="0" maxOccurs="1"/>
1296
1305
</xs:sequence>
1297
1306
<xs:attribute name="BTCPP_format" type="xs:string" use="required"/>
1298
- <xs:attribute name="main_tree_to_execute" type="xs:string" use="required "/>
1307
+ <xs:attribute name="main_tree_to_execute" type="xs:string" use="optional "/>
1299
1308
</xs:complexType>
1300
1309
</xs:element>
1301
1310
)" ;
0 commit comments