When YAZ is compiled without Libxml2 support (YAZ_HAVE_XML2 is unset),
the types xmlNode and xmlDocPtr are no longer defined in xmltypes.h.
Problem was that these dummy definitions could clash with other apps that
used Libxml2 anyway.
/** \brief configures CCL bibset using XML configuration
\param bibset CCL bibliographic profile
\param ptr xml node pointer pointing to "cclmap" element
/** \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);
YAZ_EXPORT
int ccl_xml_config(CCL_bibset bibset, const xmlNode *ptr,
const char **addinfo);
void (*ungetbyte)(int b, void *client_data),
void *client_data);
void (*ungetbyte)(int b, void *client_data),
void *client_data);
/** \brief parses MARCXML/MarcXchange record from xmlNode pointer
\param mt handle
\param ptr is a pointer to root xml node
/** \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);
Returns 0=OK, -1=ERROR
*/
YAZ_EXPORT int yaz_marc_read_xml(yaz_marc_t mt, const xmlNode *ptr);
/** \brief writes record in line format
\param mt handle
/** \brief writes record in line format
\param mt handle
*/
YAZ_EXPORT int yaz_marc_write_mode(yaz_marc_t mt, WRBUF wrbuf);
*/
YAZ_EXPORT int yaz_marc_write_mode(yaz_marc_t mt, WRBUF wrbuf);
/** \brief writes MARC record as libxml2 tree
\param mt handle
\param root_ptr pointer to record node
/** \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);
const char *ns,
const char *format,
const char *type);
/** \brief sets leader spec (for modifying bytes in 24 byte leader)
\param mt handle
/** \brief sets leader spec (for modifying bytes in 24 byte leader)
\param mt handle
const char *data, size_t data_len);
const char *data, size_t data_len);
/** \brief adds controlfield to MARC structure using xml Nodes
\param mt handle
\param ptr_tag value of tag (TEXT xmlNode)
/** \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);
YAZ_EXPORT
void yaz_marc_add_controlfield_xml(yaz_marc_t mt, const xmlNode *ptr_tag,
const xmlNode *ptr_data);
/** \brief adds datafield to MARC structure using strings
\param mt handle
/** \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);
void yaz_marc_add_datafield(yaz_marc_t mt, const char *tag,
const char *indicator, size_t indicator_len);
/** \brief adds datafield to MARC structure using xml Nodes
\param mt handle
\param ptr_tag value of tag (TEXT xmlNode)
/** \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);
YAZ_EXPORT
void yaz_marc_add_datafield_xml(yaz_marc_t mt, const xmlNode *ptr_tag,
const char *indicator, size_t indicator_len);
/** \brief returns memory for MARC handle
\param mt handle
/** \brief returns memory for MARC handle
\param mt handle
/** \brief copies TEXT Libxml2 node data to NMEM */
YAZ_EXPORT char *nmem_text_node_cdata(const xmlNode *ptr, NMEM nmem);
/** \brief copies TEXT Libxml2 node data to NMEM */
YAZ_EXPORT char *nmem_text_node_cdata(const xmlNode *ptr, NMEM nmem);
*/
YAZ_EXPORT void yaz_record_conv_destroy(yaz_record_conv_t p);
*/
YAZ_EXPORT void yaz_record_conv_destroy(yaz_record_conv_t p);
/** configures record conversion
\param p record conversion handle
\param node xmlNode pointer (root element of XML config)
/** 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);
*/
YAZ_EXPORT
int yaz_record_conv_configure(yaz_record_conv_t p, const xmlNode *node);
/** performs record conversion on record buffer (OCTET aligned)
\param p record conversion handle
/** performs record conversion on record buffer (OCTET aligned)
\param p record conversion handle
*/
YAZ_EXPORT void yaz_retrieval_destroy(yaz_retrieval_t p);
*/
YAZ_EXPORT void yaz_retrieval_destroy(yaz_retrieval_t p);
/** configures retrieval
\param p retrieval handle
\param node xmlNode pointer (root element of XML config)
/** 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);
*/
YAZ_EXPORT
int yaz_retrieval_configure(yaz_retrieval_t p, const xmlNode *node);
/** performs retrieval request based on schema and format
\param p retrieval handle
/** performs retrieval request based on schema and format
\param p retrieval handle
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);
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);
- * \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
*/
#ifndef YAZ_XMLTYPES_H
#define YAZ_XMLTYPES_H
#include <libxml/tree.h>
#endif
#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:
#endif
/*
* Local variables:
-#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;
-}
static int libxml2_error_level = 0;
static int libxml2_error_level = 0;
static void proxy_xml_error_handler(void *ctx, const char *fmt, ...)
{
char buf[1024];
static void proxy_xml_error_handler(void *ctx, const char *fmt, ...)
{
char buf[1024];
int libxml2_error_to_yazlog(int level, const char *lead_msg)
{
libxml2_error_level = level;
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_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;
return 0;
#else
return -1;
int yaz_marc_read_xml(yaz_marc_t mt, const xmlNode *ptr)
{
int yaz_marc_read_xml(yaz_marc_t mt, const xmlNode *ptr)
{
yaz_marc_reset(mt);
for(; ptr; ptr = ptr->next)
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);
if (yaz_marc_read_xml_leader(mt, &ptr))
return -1;
return yaz_marc_read_xml_fields(mt, ptr->next);
-#else
- return -1;
-#endif
int yaz_marc_write_xml(yaz_marc_t mt, xmlNode **root_ptr,
const char *ns,
const char *format,
const char *type)
{
int yaz_marc_write_xml(yaz_marc_t mt, xmlNode **root_ptr,
const char *ns,
const char *format,
const char *type)
{
struct yaz_marc_node *n;
int identifier_length;
const char *leader = 0;
struct yaz_marc_node *n;
int identifier_length;
const char *leader = 0;
}
wrbuf_destroy(wr_cdata);
return 0;
}
wrbuf_destroy(wr_cdata);
return 0;
-#else
- return -1;
-#endif
int yaz_marc_write_iso2709(yaz_marc_t mt, WRBUF wr)
{
int yaz_marc_write_iso2709(yaz_marc_t mt, WRBUF wr)
{