YAZ_BEGIN_CDECL
+#if YAZ_HAVE_XML2
/** \brief configures CCL bibset using XML configuration
\param bibset CCL bibliographic profile
\param ptr xml node pointer pointing to "cclmap" element
YAZ_EXPORT
int ccl_xml_config(CCL_bibset bibset, const xmlNode *ptr,
const char **addinfo);
-
+#endif
YAZ_END_CDECL
#endif
void (*ungetbyte)(int b, void *client_data),
void *client_data);
+#if YAZ_HAVE_XML2
/** \brief parses MARCXML/MarcXchange record from xmlNode pointer
\param mt handle
\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 xmlNode *ptr);
+#endif
/** \brief writes record in line format
\param mt handle
*/
YAZ_EXPORT int yaz_marc_write_mode(yaz_marc_t mt, WRBUF wrbuf);
+#if YAZ_HAVE_XML2
/** \brief writes MARC record as libxml2 tree
\param mt handle
\param root_ptr pointer to record node
const char *ns,
const char *format,
const char *type);
+#endif
/** \brief sets leader spec (for modifying bytes in 24 byte leader)
\param mt handle
const char *data, size_t data_len);
+#if YAZ_HAVE_XML2
/** \brief adds controlfield to MARC structure using xml Nodes
\param mt handle
\param ptr_tag value of tag (TEXT xmlNode)
YAZ_EXPORT
void yaz_marc_add_controlfield_xml(yaz_marc_t mt, const xmlNode *ptr_tag,
const xmlNode *ptr_data);
-
+#endif
/** \brief adds datafield to MARC structure using strings
\param mt handle
void yaz_marc_add_datafield(yaz_marc_t mt, const char *tag,
const char *indicator, size_t indicator_len);
+#if YAZ_HAVE_XML2
/** \brief adds datafield to MARC structure using xml Nodes
\param mt handle
\param ptr_tag value of tag (TEXT xmlNode)
YAZ_EXPORT
void yaz_marc_add_datafield_xml(yaz_marc_t mt, const xmlNode *ptr_tag,
const char *indicator, size_t indicator_len);
-
+#endif
/** \brief returns memory for MARC handle
\param mt handle
YAZ_BEGIN_CDECL
+#if YAZ_HAVE_XML2
/** \brief copies TEXT Libxml2 node data to NMEM */
YAZ_EXPORT char *nmem_text_node_cdata(const xmlNode *ptr, NMEM nmem);
+#endif
YAZ_END_CDECL
*/
YAZ_EXPORT void yaz_record_conv_destroy(yaz_record_conv_t p);
+#if YAZ_HAVE_XML2
/** configures record conversion
\param p record conversion handle
\param node xmlNode pointer (root element of XML config)
*/
YAZ_EXPORT
int yaz_record_conv_configure(yaz_record_conv_t p, const xmlNode *node);
+#endif
/** performs record conversion on record buffer (OCTET aligned)
\param p record conversion handle
*/
YAZ_EXPORT void yaz_retrieval_destroy(yaz_retrieval_t p);
+#if YAZ_HAVE_XML2
/** configures retrieval
\param p retrieval handle
\param node xmlNode pointer (root element of XML config)
*/
YAZ_EXPORT
int yaz_retrieval_configure(yaz_retrieval_t p, const xmlNode *node);
-
+#endif
/** performs retrieval request based on schema and format
\param p retrieval handle
YAZ_BEGIN_CDECL
+#if YAZ_HAVE_XML2
YAZ_EXPORT void yaz_query2xml(const Z_Query *q, xmlDocPtr *docp);
YAZ_EXPORT void yaz_rpnquery2xml(const Z_RPNQuery *rpn, xmlDocPtr *docp);
YAZ_EXPORT void yaz_xml2query(const xmlNode *xmlnodep, Z_Query **query,
ODR odr, int *error_code, const char **addinfo);
-
+#endif
YAZ_END_CDECL
#endif
/**
* \file xmltypes.h
- * \brief Define fundamental Libxml2 types for functions YAZ provide.
- * \details If Libxml2 is not installed, we define dummy types instead.
+ * \brief Define xmlNode and xmlDocPtr if Libxml2 is present
*/
#ifndef YAZ_XMLTYPES_H
#define YAZ_XMLTYPES_H
#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:
}
return 0;
}
-#else
-int ccl_xml_config(CCL_bibset bibset, const xmlNode *ptr, const char **addinfo)
-{
- *addinfo = "CCL XML configuration not supported. Libxml2 is disabled";
- return -1;
-}
#endif
/*
static int libxml2_error_level = 0;
+#if YAZ_HAVE_XML2
static void proxy_xml_error_handler(void *ctx, const char *fmt, ...)
{
char buf[1024];
va_end (ap);
}
+#endif
int libxml2_error_to_yazlog(int level, const char *lead_msg)
{
libxml2_error_level = level;
+#if YAZ_HAVE_XML2
+ xmlSetGenericErrorFunc((void *) "XML", proxy_xml_error_handler);
#if YAZ_HAVE_XSLT
xsltSetGenericErrorFunc((void *) "XSLT", proxy_xml_error_handler);
#endif
-#if YAZ_HAVE_XML2
- xmlSetGenericErrorFunc((void *) "XML", proxy_xml_error_handler);
return 0;
#else
return -1;
}
#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 (yaz_marc_read_xml_leader(mt, &ptr))
return -1;
return yaz_marc_read_xml_fields(mt, ptr->next);
-#else
- return -1;
-#endif
}
+#endif
/*
}
+#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;
}
wrbuf_destroy(wr_cdata);
return 0;
-#else
- return -1;
-#endif
}
+#endif
int yaz_marc_write_iso2709(yaz_marc_t mt, WRBUF wr)
{