320 throw mp::XMLError(
"Empty XML Document");
322 const xmlNode* root = xmlDocGetRootElement(doc);
324 if (file_include_path)
326 int r = yaz_xml_include_glob((xmlNode *) root, file_include_path,
327 YAZ_FILE_GLOB_FAIL_NOTEXIST);
329 throw mp::XMLError(
"YAZ XML Include failed");
332 mp::xml::check_element_mp(root,
"metaproxy");
334 const xmlNode* node = mp::xml::jump_to_children(root, XML_ELEMENT_NODE);
336 if (mp::xml::is_element_mp(node,
"dlpath"))
339 node = mp::xml::jump_to_next(node, XML_ELEMENT_NODE);
342 if (mp::xml::check_element_mp(node,
"start"))
344 const struct _xmlAttr *attr;
345 for (attr = node->properties; attr; attr = attr->next)
347 std::string name = std::string((
const char *) attr->name);
350 if (attr->children && attr->children->type == XML_TEXT_NODE)
351 value = std::string((
const char *)attr->children->content);
355 else if (name ==
"base")
358 throw mp::XMLError(
"Only attribute route allowed"
359 " in element 'start'. Got " + name);
361 node = mp::xml::jump_to_next(node, XML_ELEMENT_NODE);
364 if (mp::xml::is_element_mp(node,
"filters"))
368 test_only, file_include_path);
370 node = mp::xml::jump_to_next(node, XML_ELEMENT_NODE);
373 mp::xml::check_element_mp(node,
"routes");
376 test_only, file_include_path);
378 node = mp::xml::jump_to_next(node, XML_ELEMENT_NODE);
381 throw mp::XMLError(
"Unexpected element "
382 + std::string((
const char *)node->name));
385 node = mp::xml::jump_to_children(root, XML_ELEMENT_NODE);
388 if (mp::xml::is_element_mp(node,
"filters"))
390 mp::xml::jump_to_children(node,
392 else if (mp::xml::is_element_mp(node,
"routes"))
394 const xmlNode* n = mp::xml::jump_to_children(node,
398 if (mp::xml::is_element_mp(n,
"route"))
401 mp::xml::jump_to_children(n, XML_ELEMENT_NODE));
404 n = mp::xml::jump_to_next(n, XML_ELEMENT_NODE);
407 node = mp::xml::jump_to_next(node, XML_ELEMENT_NODE);
409 std::map<std::string,RouterFleXML::Route>::iterator it;
412 throw mp::XMLError(
"Start route '" +
m_start_route +
"' not found");