+ yp2::xml::check_element_yp2(node, "route");
+
+ unsigned int route_nr = 0;
+ while(yp2::xml::is_element_yp2(node, "route"))
+ {
+ route_nr++;
+
+ 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 == "id")
+ id_value = value;
+ else
+ throw yp2::XMLError("Only attribute 'id' allowed for"
+ " element 'route'."
+ " Got " + name);
+ }
+
+ Route route;
+
+ // process <filter> nodes in third level
+ const xmlNode* node3 = yp2::xml::jump_to_children(node, XML_ELEMENT_NODE);
+
+ unsigned int filter3_nr = 0;
+ while(node3 && yp2::xml::check_element_yp2(node3, "filter"))
+ {
+ filter3_nr++;
+
+ const struct _xmlAttr *attr;
+ std::string refid_value;
+ std::string type_value;
+ for (attr = node3->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 == "refid")
+ refid_value = value;
+ else if (name == "type")
+ type_value = value;
+ else
+ throw yp2::XMLError("Only attribute 'refid' or 'type'"
+ " allowed for element 'filter'."
+ " Got " + name);
+ }
+ if (refid_value.length())
+ {
+ std::map<std::string,
+ boost::shared_ptr<const yp2::filter::Base > >::iterator it;
+ it = m_id_filter_map.find(refid_value);
+ if (it == m_id_filter_map.end())
+ throw yp2::XMLError("Unknown filter refid "
+ + refid_value);
+ else
+ route.m_list.push_back(it->second);
+ }
+ else if (type_value.length())
+ {
+ yp2::filter::Base* filter_base = m_factory->create(type_value);
+
+ filter_base->configure(node3);
+
+ route.m_list.push_back(
+ boost::shared_ptr<yp2::filter::Base>(filter_base));
+ }
+ node3 = yp2::xml::jump_to_next(node3, XML_ELEMENT_NODE);
+
+ }
+ 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);
+ }