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)
@@ -677,9 +678,13 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
677678 }
678679
679680 PortsRemapping port_remap;
681+ NonPortAttributes other_attributes;
682+
680683 for (const XMLAttribute* att = element->FirstAttribute (); att; att = att->Next ())
681684 {
682- if (IsAllowedPortName (att->Name ()))
685+ const std::string port_name = att->Name ();
686+ const std::string port_value = att->Value ();
687+ if (IsAllowedPortName (port_name))
683688 {
684689 const std::string port_name = att->Name ();
685690 const std::string port_value = att->Value ();
@@ -721,6 +726,10 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
721726
722727 port_remap[port_name] = port_value;
723728 }
729+ else if (!IsReservedAttribute (port_name))
730+ {
731+ other_attributes[port_name] = port_value;
732+ }
724733 }
725734
726735 NodeConfig config;
@@ -738,6 +747,7 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
738747 if (auto script = element->Attribute (attr_name))
739748 {
740749 conditions.insert ({ ID, std::string (script) });
750+ other_attributes.erase (attr_name);
741751 }
742752 };
743753
@@ -752,6 +762,7 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
752762 AddCondition (config.post_conditions , toStr (post ).c_str (), post );
753763 }
754764
765+ config.other_attributes = other_attributes;
755766 // ---------------------------------------------
756767 TreeNode::Ptr new_node;
757768
0 commit comments