1818#include < sstream>
1919#include < string>
2020#include < typeindex>
21+ #include " behaviortree_cpp/basic_types.h"
2122
2223#if defined(_MSVC_LANG) && !defined(__clang__)
2324#define __bt_cplusplus (_MSC_VER == 1900 ? 201103L : _MSVC_LANG)
@@ -654,13 +655,13 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
654655 }
655656
656657 PortsRemapping port_remap;
658+ OtherAttributes other_attributes;
657659 for (const XMLAttribute* att = element->FirstAttribute (); att; att = att->Next ())
658660 {
659- if (IsAllowedPortName (att->Name ()))
661+ const std::string port_name = att->Name ();
662+ const std::string port_value = att->Value ();
663+ if (IsAllowedPortName (port_name))
660664 {
661- const std::string port_name = att->Name ();
662- const std::string port_value = att->Value ();
663-
664665 if (manifest)
665666 {
666667 auto port_model_it = manifest->ports .find (port_name);
@@ -696,6 +697,10 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
696697
697698 port_remap[port_name] = port_value;
698699 }
700+ else if (!IsNodeNameAttribute (port_name))
701+ {
702+ other_attributes[port_name] = port_value;
703+ }
699704 }
700705
701706 NodeConfig config;
@@ -713,6 +718,7 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
713718 if (auto script = element->Attribute (attr_name))
714719 {
715720 conditions.insert ({ ID, std::string (script) });
721+ other_attributes.erase (attr_name);
716722 }
717723 };
718724
@@ -727,6 +733,7 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
727733 AddCondition (config.post_conditions , toStr (post ).c_str (), post );
728734 }
729735
736+ config.other_attributes = other_attributes;
730737 // ---------------------------------------------
731738 TreeNode::Ptr new_node;
732739
0 commit comments