-/*
- * Copyright (C) 1995-2006, Index Data ApS
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2009 Index Data
* See the file LICENSE for details.
- *
- * $Id: marc_read_xml.c,v 1.1 2006-12-15 12:37:18 adam Exp $
*/
/**
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)
{
yaz_marc_cprintf(
mt, "Expected element 'leader', got '%.80s'", ptr->name);
- return -1;
}
}
if (!leader)
yaz_marc_cprintf(
mt, "Bad attribute '%.80s' for 'datafield'",
attr->name);
- return -1;
}
if (!ptr_tag)
{
}
#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)
{
if (yaz_marc_read_xml_leader(mt, &ptr))
return -1;
return yaz_marc_read_xml_fields(mt, ptr->next);
-#else
- return -1;
-#endif
}
+#endif
/*
* Local variables:
* c-basic-offset: 4
+ * c-file-style: "Stroustrup"
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab