X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fmarc_read_xml.c;h=3615a6a9b2660b85cad95bea2d623c249f9d63e5;hp=ce9cc7dbdc7fad7a60a4c5e169d83f558d3f3e41;hb=ecc1ee5b177fdc11ed531dfe13b5c3aae52b2843;hpb=8d691989077a0addcbd840d769dce6700f3d9622 diff --git a/src/marc_read_xml.c b/src/marc_read_xml.c index ce9cc7d..3615a6a 100644 --- a/src/marc_read_xml.c +++ b/src/marc_read_xml.c @@ -1,8 +1,6 @@ -/* - * Copyright (C) 1995-2007, Index Data ApS +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2008 Index Data * See the file LICENSE for details. - * - * $Id: marc_read_xml.c,v 1.2 2007-01-03 08:42:15 adam Exp $ */ /** @@ -74,7 +72,7 @@ int yaz_marc_read_xml_subfields(yaz_marc_t mt, const xmlNode *ptr) for (p = ptr->children; p ; p = p->next) if (p->type == XML_TEXT_NODE) ctrl_data_len += strlen((const char *)p->content); - ctrl_data_buf = nmem_malloc(nmem, ctrl_data_len+1); + ctrl_data_buf = (char *) nmem_malloc(nmem, ctrl_data_len+1); strcpy(ctrl_data_buf, (const char *)ptr_code->content); for (p = ptr->children; p ; p = p->next) if (p->type == XML_TEXT_NODE) @@ -118,7 +116,6 @@ static int yaz_marc_read_xml_leader(yaz_marc_t mt, const xmlNode **ptr_p) { yaz_marc_cprintf( mt, "Expected element 'leader', got '%.80s'", ptr->name); - return -1; } } if (!leader) @@ -194,7 +191,6 @@ static int yaz_marc_read_xml_fields(yaz_marc_t mt, const xmlNode *ptr) yaz_marc_cprintf( mt, "Bad attribute '%.80s' for 'datafield'", attr->name); - return -1; } if (!ptr_tag) { @@ -221,9 +217,11 @@ static int yaz_marc_read_xml_fields(yaz_marc_t mt, const xmlNode *ptr) } #endif +#if YAZ_HAVE_XML2 int yaz_marc_read_xml(yaz_marc_t mt, const xmlNode *ptr) { -#if YAZ_HAVE_XML2 + yaz_marc_reset(mt); + for(; ptr; ptr = ptr->next) if (ptr->type == XML_ELEMENT_NODE) { @@ -247,10 +245,8 @@ int yaz_marc_read_xml(yaz_marc_t mt, const xmlNode *ptr) if (yaz_marc_read_xml_leader(mt, &ptr)) return -1; return yaz_marc_read_xml_fields(mt, ptr->next); -#else - return -1; -#endif } +#endif /*