Omit definitions of xmlNode and xmlDocPtr if YAZ_HAVE_XML2 is unset.
[yaz-moved-to-github.git] / src / marcdisp.c
index e1c6b03..2f5f0d5 100644 (file)
@@ -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: marcdisp.c,v 1.52 2007-12-17 20:59:30 adam Exp $
  */
 
 /**
@@ -20,6 +18,7 @@
 
 #include <stdarg.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
 #include <yaz/marcdisp.h>
@@ -701,6 +700,8 @@ static int yaz_marc_write_marcxml_ns(yaz_marc_t mt, WRBUF wr,
 
 int yaz_marc_write_marcxml(yaz_marc_t mt, WRBUF wr)
 {
+    /* set leader 09 to 'a' for UNICODE */
+    /* http://www.loc.gov/marc/bibliographic/ecbdldrd.html#mrcblea */
     if (!mt->leader_spec)
         yaz_marc_modify_leader(mt, 9, "a");
     return yaz_marc_write_marcxml_ns(mt, wr, "http://www.loc.gov/MARC21/slim",
@@ -717,12 +718,12 @@ int yaz_marc_write_marcxchange(yaz_marc_t mt, WRBUF wr,
 }
 
 
+#if YAZ_HAVE_XML2
 int yaz_marc_write_xml(yaz_marc_t mt, xmlNode **root_ptr,
                        const char *ns, 
                        const char *format,
                        const char *type)
 {
-#if YAZ_HAVE_XML2
     struct yaz_marc_node *n;
     int identifier_length;
     const char *leader = 0;
@@ -827,10 +828,8 @@ int yaz_marc_write_xml(yaz_marc_t mt, xmlNode **root_ptr,
     }
     wrbuf_destroy(wr_cdata);
     return 0;
-#else
-    return -1;
-#endif
 }
+#endif
 
 int yaz_marc_write_iso2709(yaz_marc_t mt, WRBUF wr)
 {
@@ -1008,6 +1007,11 @@ void yaz_marc_iconv(yaz_marc_t mt, yaz_iconv_t cd)
     mt->iconv_cd = cd;
 }
 
+yaz_iconv_t yaz_marc_get_iconv(yaz_marc_t mt)
+{
+    return mt->iconv_cd;
+}
+
 void yaz_marc_modify_leader(yaz_marc_t mt, size_t off, const char *str)
 {
     struct yaz_marc_node *n;