+void yp2::filter::Virt_db::configure(const xmlNode * ptr)
+{
+ for (ptr = ptr->children; ptr; ptr = ptr->next)
+ {
+ if (ptr->type != XML_ELEMENT_NODE)
+ continue;
+ if (!strcmp((const char *) ptr->name, "virtual"))
+ {
+ std::string database;
+ std::string target;
+ xmlNode *v_node = ptr->children;
+ for (; v_node; v_node = v_node->next)
+ {
+ if (v_node->type != XML_ELEMENT_NODE)
+ continue;
+
+ if (yp2::xml::is_element_yp2(v_node, "database"))
+ database = yp2::xml::get_text(v_node);
+ else if (yp2::xml::is_element_yp2(v_node, "target"))
+ target = yp2::xml::get_text(v_node);
+ else
+ throw yp2::filter::FilterException
+ ("Bad element "
+ + std::string((const char *) v_node->name)
+ + " in virtual section"
+ );
+ }
+ add_map_db2vhost(database, target);
+ std::cout << "Add " << database << "->" << target << "\n";
+ }
+ else
+ {
+ throw yp2::filter::FilterException
+ ("Bad element "
+ + std::string((const char *) ptr->name)
+ + " in virt_db filter");
+ }
+ }
+}