+ }
+ }
+ return 0;
+}
+#endif
+
+const char *Yaz_ProxyConfig::get_explain_name(const char *db,
+ const char **backend_db)
+{
+#if HAVE_XSLT
+ xmlNodePtr ptr_target, ptr_explain;
+ if (m_cp->get_explain_ptr(0, db, &ptr_target, &ptr_explain)
+ && ptr_target)
+ {
+ struct _xmlAttr *attr;
+ const char *name = 0;
+
+ for (attr = ptr_target->properties; attr; attr = attr->next)
+ if (!strcmp((const char *) attr->name, "name")
+ && attr->children
+ && attr->children->type==XML_TEXT_NODE
+ && attr->children->content
+ && attr->children->content[0])
+ {
+ name = (const char *)attr->children->content;
+ break;
+ }
+ if (name)
+ {
+ for (attr = ptr_target->properties; attr; attr = attr->next)
+ if (!strcmp((const char *) attr->name, "database"))
+ {
+ if (attr->children
+ && attr->children->type==XML_TEXT_NODE
+ && attr->children->content)
+ *backend_db = (const char *) attr->children->content;
+ }
+ return name;
+ }
+ }
+#endif
+ return 0;
+}
+
+char *Yaz_ProxyConfig::get_explain_doc(ODR odr, const char *name,
+ const char *db, int *len)
+{
+#if HAVE_XSLT
+ xmlNodePtr ptr_target, ptr_explain;
+ if (m_cp->get_explain_ptr(0 /* host */, db, &ptr_target, &ptr_explain))
+ {
+ xmlNodePtr ptr2 = xmlCopyNode(ptr_explain, 1);
+
+ xmlDocPtr doc = xmlNewDoc((const xmlChar *) "1.0");
+
+ xmlDocSetRootElement(doc, ptr2);
+
+ xmlChar *buf_out;
+ xmlDocDumpMemory(doc, &buf_out, len);
+ char *content = (char*) odr_malloc(odr, *len);
+ memcpy(content, buf_out, *len);
+
+ xmlFree(buf_out);
+ xmlFreeDoc(doc);
+ return content;