+ std::map<std::string,RouterFleXML::Route>::iterator it;
+ it = m_routes.find(id_value);
+ if (it != m_routes.end())
+ throw yp2::XMLError("Route id='" + id_value
+ + "' already exist");
+ else
+ m_routes[id_value] = route;
+ node = yp2::xml::jump_to_next(node, XML_ELEMENT_NODE);
+ }
+}
+
+void yp2::RouterFleXML::Rep::parse_xml_config_dom(xmlDocPtr doc)
+{
+ if (!doc)
+ throw yp2::XMLError("Empty XML Document");
+
+ const xmlNode* root = xmlDocGetRootElement(doc);
+
+ yp2::xml::check_element_yp2(root, "yp2");
+
+ // process <start> node which is expected first element node
+ const xmlNode* node = yp2::xml::jump_to_children(root, XML_ELEMENT_NODE);
+ if (yp2::xml::check_element_yp2(node, "start"))
+ {
+ const struct _xmlAttr *attr;
+ std::string id_value;
+ 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")
+ m_start_route = value;
+ else
+ throw yp2::XMLError("Only attribute start allowed"
+ " in element 'start'. Got " + name);
+ }
+ node = yp2::xml::jump_to_next(node, XML_ELEMENT_NODE);
+ }
+ // process <filters> node which is expected second element node
+ yp2::xml::check_element_yp2(node, "filters");
+
+ parse_xml_filters(doc, yp2::xml::jump_to_children(node, XML_ELEMENT_NODE));
+
+ // process <routes> node which is expected third element node
+ node = yp2::xml::jump_to_next(node, XML_ELEMENT_NODE);
+ yp2::xml::check_element_yp2(node, "routes");
+
+ parse_xml_routes(doc, yp2::xml::jump_to_children(node, XML_ELEMENT_NODE));
+
+ node = yp2::xml::jump_to_next(node, XML_ELEMENT_NODE);
+ if (node)
+ {
+ throw yp2::XMLError("Unexpected element "
+ + std::string((const char *)node->name));