-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
Something like this:
//! Utility function for finding the first node of
//! a list of names.
//! \param elem XML node the node should retrieved from
//! \param node_names Names of requested nodes
//! \returns Pointer to found XML node
inline rapidxml::xml_node<>* find_first_node_of_ns(
const rapidxml::xml_node<>& elem,
const Ch* namespace,
const std::vector<std::string>& node_names)
{
using namespace rapidxml;
xml_node<>* result;
for (auto name : node_names)
{
result = elem.first_node_ns(namespace, name);
if (result)
{
return result;
}
}
return result;
}Then it is possible to retrieve several node types:
std::vector<std::string> elem_list = { "Folder",
"ContactsFolder", "SearchFolder", "TaskFolder" };
const auto folder_elem = item_elem.find_first_node_of_ns(
internal::uri<>::microsoft::types(), elem_list);
check(folder_elem,
"Expected <Folder>, <ContactsFolder>, <SearchFolder> or <TaskFolder> element");Originally posted by @idolum in #156 (comment)