* Copyright (c) 1998-2004, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-proxy-config.cpp,v 1.22 2004-01-07 13:24:12 adam Exp $
+ * $Id: yaz-proxy-config.cpp,v 1.26 2004-01-29 21:33:39 adam Exp $
*/
#include <ctype.h>
}
if (match)
{
- syntax_has_matched = 1;
+ if (!match_error)
+ syntax_has_matched = 1;
match = check_schema(ptr->children, comp, match_identifier);
}
if (match)
}
if (match_error)
{
- if (syntax_has_matched) // if syntax did match, schema/ESN was bad
+ if (syntax_has_matched) // if syntax OK, bad schema/ESN
return 25;
if (syntax)
{
if (ptr->type == XML_ELEMENT_NODE &&
!strcmp((const char *) ptr->name, "explain"))
{
+ xmlNodePtr ptr1 = ptr->children;
+ if (db)
+ {
+ for (; ptr1; ptr1 = ptr1->next)
+ if (ptr1->type == XML_ELEMENT_NODE &&
+ !strcmp((const char *) ptr1->name, "serverInfo"))
+ break;
+ if (!ptr1)
+ continue;
+ for (ptr1 = ptr1->children; ptr1; ptr1 = ptr1->next)
+ if (ptr1->type == XML_ELEMENT_NODE &&
+ !strcmp((const char *) ptr1->name, "database"))
+ break;
+
+ if (!ptr1)
+ continue;
+ for (ptr1 = ptr1->children; ptr1; ptr1 = ptr1->next)
+ if (ptr1->type == XML_TEXT_NODE &&
+ ptr1->content &&
+ !strcmp((const char *) ptr1->content, db))
+ break;
+ if (!ptr1)
+ continue;
+ }
xmlNodePtr ptr2 = xmlCopyNode(ptr, 1);
xmlDocPtr doc = xmlNewDoc((const xmlChar *) "1.0");
xmlDocSetRootElement(doc, ptr2);
xmlChar *buf_out;
- int len_out;
xmlDocDumpMemory(doc, &buf_out, len);
char *content = (char*) odr_malloc(odr, *len);
memcpy(content, buf_out, *len);
return content;
}
}
- else
- yaz_log(LOG_WARN, "No explain node 1");
-
#endif
yaz_log(LOG_WARN, "No explain node");
return 0;