Skip to content

Commit fd760d3

Browse files
author
Gaël Écorchard
committed
Add support for XML content in nodes
Only the XML content that appears as first child of a node is considered. If the XML content appears after the first child (no counting comments), it is ignored. The XML content is added to the NodeConfig structure under the `xml_content` field.
1 parent bcc7fd4 commit fd760d3

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

include/behaviortree_cpp/tree_node.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ struct NodeConfig
8484
PortsRemapping input_ports;
8585
// output ports
8686
PortsRemapping output_ports;
87+
// Node content (in the XML sense).
88+
std::string xml_content;
8789

8890
const TreeNodeManifest* manifest = nullptr;
8991

src/xml_parsing.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,13 @@ TreeNode::Ptr XMLParser::PImpl::createNodeFromXML(const XMLElement* element,
697697
}
698698
}
699699

700+
// Get the XML content of the node.
701+
const char* xml_content = element->GetText();
702+
if (xml_content != nullptr)
703+
{
704+
config.xml_content = xml_content;
705+
}
706+
700707
new_node = factory.instantiateTreeNode(instance_name, type_ID, config);
701708
}
702709

0 commit comments

Comments
 (0)