-xmlNodePtr Yaz_ProxyConfigP::find_target_db(xmlNodePtr ptr, const char *db)
-{
- xmlNodePtr dptr;
- if (!db)
- return ptr;
- if (!ptr)
- return 0;
- for (dptr = ptr->children; dptr; dptr = dptr->next)
- if (dptr->type == XML_ELEMENT_NODE &&
- !strcmp((const char *) dptr->name, "database"))
- {
- struct _xmlAttr *attr;
- for (attr = dptr->properties; attr; attr = attr->next)
- if (!strcmp((const char *) attr->name, "name"))
- {
- if (attr->children
- && attr->children->type==XML_TEXT_NODE
- && attr->children->content
- && (!strcmp((const char *) attr->children->content, db)
- || !strcmp((const char *) attr->children->content,
- "*")))
- return dptr;
- }
- }
- return ptr;
-}