X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fxmlquery.c;h=4728de64f6c66e18d54d6b030ff2a933e1ebe143;hp=e0db8d3c40160e66a13eb55e88eea7f6a6c27a5b;hb=b2bc97df294f5da6c93e1119a42536b23afce8ef;hpb=0c46d2e66bdeea1600e700124a81a5d0a65d349e diff --git a/src/xmlquery.c b/src/xmlquery.c index e0db8d3..4728de6 100644 --- a/src/xmlquery.c +++ b/src/xmlquery.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2013 Index Data + * Copyright (C) Index Data * See the file LICENSE for details. */ /** \file xmlquery.c @@ -20,6 +20,7 @@ #include #include #include +#include #include static int check_diagnostic(const xmlNode *ptr, ODR odr, @@ -362,7 +363,7 @@ static void yaz_xml2query_operator(const xmlNode *ptr, Z_Operator **op, ODR odr, int *error_code, const char **addinfo) { - xmlChar *type = xmlGetProp((xmlNodePtr) ptr, BAD_CAST "type"); + const char *type = yaz_xml_get_prop((xmlNodePtr) ptr, "type"); if (!type) { *error_code = 1; @@ -370,22 +371,22 @@ static void yaz_xml2query_operator(const xmlNode *ptr, Z_Operator **op, return; } *op = (Z_Operator*) odr_malloc(odr, sizeof(Z_Operator)); - if (!xmlStrcmp(type, BAD_CAST "and")) + if (!strcmp(type, "and")) { (*op)->which = Z_Operator_and; (*op)->u.op_and = odr_nullval(); } - else if (!xmlStrcmp(type, BAD_CAST "or")) + else if (!strcmp(type, "or")) { (*op)->which = Z_Operator_or; (*op)->u.op_or = odr_nullval(); } - else if (!xmlStrcmp(type, BAD_CAST "not")) + else if (!strcmp(type, "not")) { (*op)->which = Z_Operator_and_not; (*op)->u.and_not = odr_nullval(); } - else if (!xmlStrcmp(type, BAD_CAST "prox")) + else if (!strcmp(type, "prox")) { struct _xmlAttr *attr; Z_ProximityOperator *pop = (Z_ProximityOperator *) @@ -437,7 +438,6 @@ static void yaz_xml2query_operator(const xmlNode *ptr, Z_Operator **op, *error_code = 1; *addinfo = "bad operator type"; } - xmlFree(type); } static void yaz_xml2query_attribute_element(const xmlNode *ptr, @@ -565,7 +565,7 @@ static void yaz_xml2query_term(const xmlNode *ptr, Z_Term **term, ODR odr, { (*term)->which = Z_Term_general; (*term)->u.general = - odr_create_Odr_oct(odr, (unsigned char *)cdata, strlen(cdata)); + odr_create_Odr_oct(odr, cdata, strlen(cdata)); } else if (!xmlStrcmp(type, BAD_CAST "numeric")) { @@ -749,15 +749,14 @@ static void yaz_xml2query_rpnstructure(const xmlNode *ptr, Z_RPNStructure **zs, static void yaz_xml2query_rpn(const xmlNode *ptr, Z_RPNQuery **query, ODR odr, int *error_code, const char **addinfo) { - xmlChar *set = xmlGetProp((xmlNodePtr) ptr, BAD_CAST "set"); + const char *set = yaz_xml_get_prop((xmlNodePtr) ptr, "set"); *query = (Z_RPNQuery*) odr_malloc(odr, sizeof(Z_RPNQuery)); if (set) { (*query)->attributeSetId = yaz_string_to_oid_odr(yaz_oid_std(), - CLASS_ATTSET, (const char *) set, odr); - xmlFree(set); + CLASS_ATTSET, set, odr); } else (*query)->attributeSetId = 0;