73 if (!xml_file.isEmpty())
76 tinyxml2::XMLDocument document;
77 document.LoadFile(xml_file.toStdString().c_str());
78 tinyxml2::XMLElement*
config = document.RootElement();
81 ROS_ERROR(
"Skipping XML Document \"%s\" which had no Root Element. This likely means the XML is "
82 "malformed or missing.",
83 xml_file.toStdString().c_str());
84 return QSet<QString>();
86 if (std::string(
config->Name()) !=
"library" && std::string(
config->Name()) !=
"class_libraries")
88 ROS_ERROR(
"The XML document \"%s\" given to add must have either \"library\" or \
89 \"class_libraries\" as the root tag",
90 xml_file.toStdString().c_str());
91 return QSet<QString>();
94 if (std::string(
config->Name()) ==
"class_libraries")
99 tinyxml2::XMLElement* library =
config;
100 while (library !=
nullptr)
102 tinyxml2::XMLElement* class_element = library->FirstChildElement(
"class");
103 while (class_element)
105 std::string derived_class = class_element->Attribute(
"type");
107 std::string current_class_id;
108 if (class_element->Attribute(
"name") !=
nullptr)
110 current_class_id = class_element->Attribute(
"name");
111 ROS_DEBUG(
"XML file specifies lookup name (i.e. magic name) = %s.", current_class_id.c_str());
115 ROS_DEBUG(
"XML file has no lookup name (i.e. magic name) for class %s, assuming class_id == "
117 derived_class.c_str());
118 current_class_id = derived_class;
121 QSet<QString> message_types;
122 tinyxml2::XMLElement* message_type = class_element->FirstChildElement(
"message_type");
126 if (message_type->GetText())
128 const char* message_type_str = message_type->GetText();
129 ROS_DEBUG_STREAM(current_class_id <<
" supports message type " << message_type_str);
130 message_types.insert(QString(message_type_str));
132 message_type = message_type->NextSiblingElement(
"message_type");
138 class_element = class_element->NextSiblingElement(
"class");
140 library = library->NextSiblingElement(
"library");
150 return QSet<QString>();