or provide dummy alternatives if libxml2 is disabled (or does not exist).
This allows all Libxml2 related functions to be publicly defined
unconditionally. Also provides a more type safe system for applications
using these functions.
-## $Id: Makefile.am,v 1.35 2006-12-13 10:35:44 adam Exp $
+## $Id: Makefile.am,v 1.36 2006-12-13 11:25:17 adam Exp $
pkginclude_HEADERS= backend.h ccl.h cql.h comstack.h \
diagbib1.h diagsrw.h diagsru_update.h sortspec.h log.h logrpn.h marcdisp.h \
readconf.h record_conv.h retrieval.h statserv.h \
tcpip.h test.h unix.h tpath.h wrbuf.h xmalloc.h \
yaz-ccl.h yaz-iconv.h yaz-util.h yaz-version.h yconfig.h proto.h \
- xmlquery.h libxml2_error.h \
+ xmlquery.h libxml2_error.h xmltypes.h \
\
ill.h ill-core.h item-req.h z-accdes1.h z-accform1.h \
z-acckrb1.h z-core.h z-date.h z-diag1.h z-espec1.h z-estask.h z-exp.h \
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/* $Id: marcdisp.h,v 1.20 2006-12-07 11:08:04 adam Exp $ */
+/* $Id: marcdisp.h,v 1.21 2006-12-13 11:25:17 adam Exp $ */
/**
* \file marcdisp.h
#include <stdio.h>
#include <yaz/wrbuf.h>
+#include <yaz/xmltypes.h>
+
YAZ_BEGIN_CDECL
/** \brief a yaz_marc_t handle (private content) */
/** \brief parses MARCXML/MarcXchange record from xmlNode pointer
\param mt handle
- \param xmlnode is a pointer to root xmlNode pointer
+ \param ptr is a pointer to root xml node
Returns 0=OK, -1=ERROR
*/
-YAZ_EXPORT int yaz_marc_read_xml(yaz_marc_t mt, const void *xmlnode);
+YAZ_EXPORT int yaz_marc_read_xml(yaz_marc_t mt, const xmlNode *ptr);
/** \brief writes record in line format
\param mt handle
Sets leader[9]='a' . Returns 0=OK, -1=ERROR .
*/
-
YAZ_EXPORT int yaz_marc_write_marcxml(yaz_marc_t mt, WRBUF wrbuf);
/** \brief writes record in MarcXchange XML
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/* $Id: nmem_xml.h,v 1.1 2006-10-27 12:19:15 adam Exp $ */
+/* $Id: nmem_xml.h,v 1.2 2006-12-13 11:25:17 adam Exp $ */
/**
* \file nmem_xml.h
#include <yaz/nmem.h>
-#if YAZ_HAVE_XML2
-#include <libxml/parser.h>
+#include <yaz/xmltypes.h>
YAZ_BEGIN_CDECL
YAZ_END_CDECL
#endif
-#endif
/*
* Local variables:
* c-basic-offset: 4
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/* $Id: record_conv.h,v 1.6 2006-12-12 10:41:38 marc Exp $ */
+/* $Id: record_conv.h,v 1.7 2006-12-13 11:25:17 adam Exp $ */
/**
* \file record_conv.h
#include <stddef.h>
#include <yaz/wrbuf.h>
#include <yaz/yconfig.h>
+#include <yaz/xmltypes.h>
YAZ_BEGIN_CDECL
<xslt stylesheet="mods2dc.xsl"/>
</backend>
\endverbatim
-
-
*/
YAZ_EXPORT
-int yaz_record_conv_configure(yaz_record_conv_t p, const void *node);
+int yaz_record_conv_configure(yaz_record_conv_t p, const xmlNode *node);
/** performs record conversion
\param p record conversion handle
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/* $Id: retrieval.h,v 1.6 2006-10-09 21:02:41 adam Exp $ */
+/* $Id: retrieval.h,v 1.7 2006-12-13 11:25:17 adam Exp $ */
/**
* \file retrieval.h
\endverbatim
*/
YAZ_EXPORT
-int yaz_retrieval_configure(yaz_retrieval_t p, const void *node);
+int yaz_retrieval_configure(yaz_retrieval_t p, const xmlNode *node);
/** performs retrieval request based on schema and format
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/* $Id: xmlquery.h,v 1.7 2006-10-13 11:30:37 adam Exp $ */
+/* $Id: xmlquery.h,v 1.8 2006-12-13 11:25:17 adam Exp $ */
/** \file xmlquery.h
\brief Query / XML conversions
#ifndef YAZ_XMLQUERY_H
#define YAZ_XMLQUERY_H
-#if YAZ_HAVE_XML2
#include <yaz/yconfig.h>
#include <yaz/proto.h>
-
-#include <libxml/parser.h>
+#include <yaz/xmltypes.h>
YAZ_BEGIN_CDECL
YAZ_END_CDECL
#endif
-#endif
/*
* Local variables:
--- /dev/null
+/*
+ * Copyright (c) 1995-2006, Index Data
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Index Data nor the names of its contributors
+ * may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/* $Id: xmltypes.h,v 1.1 2006-12-13 11:25:17 adam Exp $ */
+
+/**
+ * \file xmltypes.h
+ * \brief Define fundamental Libxml2 types for functions YAZ provide.
+ * \details If Libxml2 is not installed, we define dummy types instead.
+ */
+#ifndef YAZ_XMLTYPES_H
+#define YAZ_XMLTYPES_H
+
+#if YAZ_HAVE_XML2
+#include <libxml/tree.h>
+#endif
+
+YAZ_BEGIN_CDECL
+
+#if YAZ_HAVE_XML2
+#else
+typedef void xmlNode;
+typedef void *xmlDocPtr;
+#endif
+
+YAZ_END_CDECL
+
+#endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
* Copyright (C) 1995-2006, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: elementset.c,v 1.1 2006-11-14 08:48:26 adam Exp $
+ * $Id: elementset.c,v 1.2 2006-12-13 11:25:17 adam Exp $
*/
/**
- * \file tpath.c
- * \brief File Path utilities
+ * \file elementset.c
+ * \brief Z39.50 element set utilities
*/
#if HAVE_CONFIG_H
* Copyright (C) 1995-2006, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: marcdisp.c,v 1.36 2006-12-07 11:08:05 adam Exp $
+ * $Id: marcdisp.c,v 1.37 2006-12-13 11:25:17 adam Exp $
*/
/**
}
return 0;
}
+#endif
-int yaz_marc_read_xml(yaz_marc_t mt, const void *xmlnode)
+int yaz_marc_read_xml(yaz_marc_t mt, const xmlNode *ptr)
{
- const xmlNode *ptr = xmlnode;
+#if YAZ_HAVE_XML2
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
-int yaz_marc_read_xml(yaz_marc_t mt, const void *xmlnode)
-{
return -1;
-}
#endif
+}
int yaz_marc_read_iso2709(yaz_marc_t mt, const char *buf, int bsize)
{
* Copyright (C) 2005-2006, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: record_conv.c,v 1.12 2006-12-12 10:41:38 marc Exp $
+ * $Id: record_conv.c,v 1.13 2006-12-13 11:25:17 adam Exp $
*/
/**
* \file record_conv.c
return 0;
}
-int yaz_record_conv_configure(yaz_record_conv_t p, const void *ptr_v)
+int yaz_record_conv_configure(yaz_record_conv_t p, const xmlNode *ptr)
{
- const xmlNode *ptr = ptr_v;
-
yaz_record_conv_reset(p);
/* parsing element children */
* Copyright (C) 2005-2006, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: retrieval.c,v 1.13 2006-12-12 10:41:38 marc Exp $
+ * $Id: retrieval.c,v 1.14 2006-12-13 11:25:17 adam Exp $
*/
/**
* \file retrieval.c
return 0;
}
-int yaz_retrieval_configure(yaz_retrieval_t p, const void *ptr_v)
+int yaz_retrieval_configure(yaz_retrieval_t p, const xmlNode *ptr)
{
- const xmlNode *ptr = ptr_v;
-
yaz_retrieval_reset(p);
if (ptr && ptr->type == XML_ELEMENT_NODE &&