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,13 +678,13 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
677678 }
678679
679680 PortsRemapping port_remap;
681+ OtherAttributes other_attributes;
680682 for (const XMLAttribute* att = element->FirstAttribute (); att; att = att->Next ())
681683 {
682- if (IsAllowedPortName (att->Name ()))
684+ const std::string port_name = att->Name ();
685+ const std::string port_value = att->Value ();
686+ if (IsAllowedPortName (port_name))
683687 {
684- const std::string port_name = att->Name ();
685- const std::string port_value = att->Value ();
686-
687688 if (manifest)
688689 {
689690 auto port_model_it = manifest->ports .find (port_name);
@@ -721,6 +722,10 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
721722
722723 port_remap[port_name] = port_value;
723724 }
725+ else if (!IsNodeNameAttribute (port_name))
726+ {
727+ other_attributes[port_name] = port_value;
728+ }
724729 }
725730
726731 NodeConfig config;
@@ -738,6 +743,7 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
738743 if (auto script = element->Attribute (attr_name))
739744 {
740745 conditions.insert ({ ID, std::string (script) });
746+ other_attributes.erase (attr_name);
741747 }
742748 };
743749
@@ -752,6 +758,7 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
752758 AddCondition (config.post_conditions , toStr (post ).c_str (), post );
753759 }
754760
761+ config.other_attributes = other_attributes;
755762 // ---------------------------------------------
756763 TreeNode::Ptr new_node;
757764
0 commit comments