+ while (node)
+ {
+ if (mp::xml::is_element_mp(node, "filters"))
+ {
+ const xmlNode* node1 =
+ mp::xml::jump_to_children(node, XML_ELEMENT_NODE);
+
+ parse_xml_filters1(doc, node1, test_only, file_include_path, route);
+ }
+ else if (mp::xml::check_element_mp(node, "filter"))
+ {
+ const struct _xmlAttr *attr;
+ std::string refid_value;
+ std::string type_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 == "refid")
+ refid_value = value;
+ else if (name == "type")
+ type_value = value;
+ else if (name == "base")
+ ;// Ignore XInclude base attribute.
+ else
+ throw mp::XMLError("Only attribute 'refid' or 'type'"
+ " allowed for element 'filter'."
+ " Got " + name);
+ }
+ if (refid_value.length())
+ {
+ std::map<std::string,
+ boost::shared_ptr<const mp::filter::Base > >::iterator it;
+ it = m_id_filter_map.find(refid_value);
+ if (it == m_id_filter_map.end())
+ throw mp::XMLError("Unknown filter refid "
+ + refid_value);
+ else
+ route.m_list.push_back(it->second);
+ }
+ else if (type_value.length())
+ {
+ if (!m_factory->exist(type_value))
+ {
+ yaz_log(YLOG_LOG, "Loading %s (dlpath %s)",
+ type_value.c_str(), m_dl_path.c_str());
+ m_factory->add_creator_dl(type_value, m_dl_path);
+ }
+ mp::filter::Base* filter_base = m_factory->create(type_value);
+
+ filter_base->configure(node, test_only, file_include_path);
+
+ route.m_list.push_back(
+ boost::shared_ptr<mp::filter::Base>(filter_base));
+ }
+
+ }
+ node = mp::xml::jump_to_next(node, XML_ELEMENT_NODE);
+ }