312{
313 if (!doc)
314 throw mp::XMLError("Empty XML Document");
315
316 const xmlNode* root = xmlDocGetRootElement(doc);
317
318 if (file_include_path)
319 {
320 int r = yaz_xml_include_glob((xmlNode *) root, file_include_path,
321 YAZ_FILE_GLOB_FAIL_NOTEXIST);
322 if (r)
323 throw mp::XMLError("YAZ XML Include failed");
324 }
325
326 mp::xml::check_element_mp(root, "metaproxy");
327
328 const xmlNode* node = mp::xml::jump_to_children(root, XML_ELEMENT_NODE);
329
330 if (mp::xml::is_element_mp(node, "dlpath"))
331 {
333 node = mp::xml::jump_to_next(node, XML_ELEMENT_NODE);
334 }
335
336 if (mp::xml::check_element_mp(node, "start"))
337 {
338 const struct _xmlAttr *attr;
339 for (attr = node->properties; attr; attr = attr->next)
340 {
341 std::string name = std::string((const char *) attr->name);
342 std::string value;
343
344 if (attr->children && attr->children->type == XML_TEXT_NODE)
345 value = std::string((const char *)attr->children->content);
346
347 if (name == "route")
349 else if (name == "base")
350 ;
351 else
352 throw mp::XMLError("Only attribute route allowed"
353 " in element 'start'. Got " + name);
354 }
355 node = mp::xml::jump_to_next(node, XML_ELEMENT_NODE);
356 }
357
358 if (mp::xml::is_element_mp(node, "filters"))
359 {
361 XML_ELEMENT_NODE),
362 test_only, file_include_path);
363
364 node = mp::xml::jump_to_next(node, XML_ELEMENT_NODE);
365 }
366
367 mp::xml::check_element_mp(node, "routes");
368
370 test_only, file_include_path);
371
372 node = mp::xml::jump_to_next(node, XML_ELEMENT_NODE);
373 if (node)
374 {
375 throw mp::XMLError("Unexpected element "
376 + std::string((const char *)node->name));
377 }
378
379 node = mp::xml::jump_to_children(root, XML_ELEMENT_NODE);
380 while (node)
381 {
382 if (mp::xml::is_element_mp(node, "filters"))
384 mp::xml::jump_to_children(node,
385 XML_ELEMENT_NODE));
386 else if (mp::xml::is_element_mp(node, "routes"))
387 {
388 const xmlNode* n = mp::xml::jump_to_children(node,
389 XML_ELEMENT_NODE);
390 while (n)
391 {
392 if (mp::xml::is_element_mp(n, "route"))
393 {
395 mp::xml::jump_to_children(n, XML_ELEMENT_NODE));
396
397 }
398 n = mp::xml::jump_to_next(n, XML_ELEMENT_NODE);
399 }
400 }
401 node = mp::xml::jump_to_next(node, XML_ELEMENT_NODE);
402 }
403 std::map<std::string,RouterFleXML::Route>::iterator it;
406 throw mp::XMLError(
"Start route '" +
m_start_route +
"' not found");
407}