X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Frecord_conv.c;h=b117340715a8fe7f1d1c6ab48757c2ef1244ca54;hp=a74b4c55a6f0753d00f8eb8d765f2c7c41be7885;hb=b2bc97df294f5da6c93e1119a42536b23afce8ef;hpb=f0379c36caadf35c41eb2acb7efad8aadaff0d68 diff --git a/src/record_conv.c b/src/record_conv.c index a74b4c5..b117340 100644 --- a/src/record_conv.c +++ b/src/record_conv.c @@ -20,6 +20,7 @@ #include #include #include +#include #if YAZ_HAVE_XML2 #include @@ -331,26 +332,23 @@ static void *construct_select(const xmlNode *ptr, return 0; else { - struct _xmlAttr *attr; NMEM nmem = nmem_create(); struct select_info *info = nmem_malloc(nmem, sizeof(*info)); + const char *attr_str; + const char *xpath = 0; info->nmem = nmem; info->xpath_expr = 0; - for (attr = ptr->properties; attr; attr = attr->next) + attr_str = yaz_xml_get_prop(ptr, "path%s", &xpath); + if (attr_str) { - if (!xmlStrcmp(attr->name, BAD_CAST "path") && - attr->children && attr->children->type == XML_TEXT_NODE) - info->xpath_expr = - nmem_strdup(nmem, (const char *) attr->children->content); - else - { - wrbuf_printf(wr_error, "Bad attribute '%s'" - "Expected xpath.", attr->name); - nmem_destroy(nmem); + wrbuf_printf(wr_error, "Bad attribute '%s'" + "Expected xpath.", attr_str); + nmem_destroy(nmem); return 0; - } } + if (xpath) + info->xpath_expr = nmem_strdup(nmem, xpath); return info; } }