+ if (!mp::xml::is_element_mp(ptr, name))
+ {
+ std::string got_element = "<";
+ if (ptr && ptr->name)
+ got_element += std::string((const char *)ptr->name);
+ if (ptr && ptr->ns && ptr->ns->href){
+ got_element += " xmlns=\"";
+ got_element += std::string((const char *)ptr->ns->href);
+ got_element += "\"";
+ }
+ got_element += ">";
+
+ throw mp::XMLError("Expected XML element <" + name
+ + " xmlns=\"" + metaproxy_ns + "\">"
+ + ", not " + got_element);
+ }
+ return true;
+}
+
+std::string mp_xml::get_route(const xmlNode *node, std::string &auth)
+{
+ std::string route_value;
+ if (node)
+ {
+ const struct _xmlAttr *attr;
+ for (attr = node->properties; attr; attr = attr->next)
+ {
+ std::string name = std::string((const char *) attr->name);
+ std::string value;
+
+ if (attr->children && attr->children->type == XML_TEXT_NODE)
+ value = std::string((const char *)attr->children->content);
+
+ if (name == "route")
+ route_value = value;
+ else if (name == "auth")
+ auth = value;
+ else
+ throw XMLError("Only attribute route allowed"
+ " in " + std::string((const char *)node->name)
+ + " element. Got " + std::string(name));
+ }
+ }
+ return route_value;
+}
+
+std::string mp_xml::get_route(const xmlNode *node)
+{
+ std::string auth;
+ return get_route(node, auth);