YAZ
5.34.0
|
Record Conversions Utility. More...
#include <stddef.h>
#include <yaz/wrbuf.h>
#include <yaz/yconfig.h>
#include <yaz/xmltypes.h>
#include <yaz/z-opac.h>
Go to the source code of this file.
Data Structures | |
struct | yaz_record_conv_type |
Typedefs | |
typedef struct yaz_record_conv_struct * | yaz_record_conv_t |
Functions | |
yaz_record_conv_t | yaz_record_conv_create (void) |
void | yaz_record_conv_destroy (yaz_record_conv_t p) |
int | yaz_record_conv_configure (yaz_record_conv_t p, const xmlNode *node) |
int | yaz_record_conv_configure_t (yaz_record_conv_t p, const xmlNode *node, struct yaz_record_conv_type *types) |
int | yaz_record_conv_record (yaz_record_conv_t p, const char *input_record_buf, size_t input_record_len, WRBUF output_record) |
int | yaz_record_conv_opac_record (yaz_record_conv_t p, Z_OPACRecord *input_record, WRBUF output_record) |
const char * | yaz_record_conv_get_error (yaz_record_conv_t p) |
void | yaz_record_conv_set_path (yaz_record_conv_t p, const char *path) |
const char * | yaz_record_get_output_charset (yaz_record_conv_t p) |
Record Conversions Utility.
Definition in file record_conv.h.
typedef struct yaz_record_conv_struct* yaz_record_conv_t |
record conversion handle
Definition at line 45 of file record_conv.h.
int yaz_record_conv_configure | ( | yaz_record_conv_t | p, |
const xmlNode * | node | ||
) |
configures record conversion
p | record conversion handle |
node | xmlNode pointer (root element of XML config) |
0 | success |
-1 | failure |
On failure, use yaz_record_conv_get_error to get error string.
<backend syntax='xml'> <xslt stylesheet="dc2marcxml.xsl"/> <marc inputformat="xml" outputformat="marcxml" outputcharset="marc-8"/> </backend>
<backend syntax='usmarc' name='F'> <marc inputformat="marc" outputformat="marcxml" inputcharset="marc-8"/> <xslt stylesheet="marcxml2mods.xsl"/> <xslt stylesheet="mods2dc.xsl"/> </backend>
Definition at line 1208 of file record_conv.c.
References yaz_record_conv_configure_t().
int yaz_record_conv_configure_t | ( | yaz_record_conv_t | p, |
const xmlNode * | node, | ||
struct yaz_record_conv_type * | types | ||
) |
configures record conversion with user-defined conversion types
p | record conversion handle |
node | xmlNode pointer (root element of XML config) |
types | conversion types |
0 | success |
-1 | failure |
Definition at line 1135 of file record_conv.c.
References yaz_record_conv_type::construct, construct_marc(), construct_rdf_lookup(), construct_select(), construct_solrmarc(), construct_xslt(), yaz_record_conv_type::convert, convert_marc(), convert_rdf_lookup(), convert_select(), convert_solrmarc(), convert_xslt(), yaz_record_conv_type::destroy, destroy_marc(), destroy_rdf_lookup(), destroy_select(), destroy_solrmarc(), destroy_xslt(), yaz_record_conv_rule::info, yaz_record_conv_rule::next, yaz_record_conv_type::next, yaz_record_conv_struct::nmem, nmem_malloc(), yaz_record_conv_struct::path, yaz_record_conv_struct::rules_p, yaz_record_conv_rule::type, yaz_record_conv_struct::wr_error, wrbuf_len, wrbuf_printf(), wrbuf_rewind(), and yaz_record_conv_reset().
Referenced by conf_retrieval(), and yaz_record_conv_configure().
yaz_record_conv_t yaz_record_conv_create | ( | void | ) |
creates record handle
Definition at line 1311 of file record_conv.c.
References yaz_record_conv_struct::nmem, nmem_create(), yaz_record_conv_struct::path, yaz_record_conv_struct::rules, yaz_record_conv_struct::wr_error, wrbuf_alloc(), and xmalloc.
Referenced by conf_retrieval().
void yaz_record_conv_destroy | ( | yaz_record_conv_t | p | ) |
destroys record handle
p | record conversion handle |
Definition at line 94 of file record_conv.c.
References yaz_record_conv_struct::nmem, nmem_destroy(), yaz_record_conv_struct::path, yaz_record_conv_struct::wr_error, wrbuf_destroy(), xfree, and yaz_record_conv_reset().
Referenced by conf_retrieval(), and yaz_retrieval_reset().
const char* yaz_record_conv_get_error | ( | yaz_record_conv_t | p | ) |
returns error string (for last error)
p | record conversion handle |
Definition at line 1298 of file record_conv.c.
References yaz_record_conv_struct::wr_error, and wrbuf_cstr().
Referenced by conf_retrieval(), and retrieve_fetch().
int yaz_record_conv_opac_record | ( | yaz_record_conv_t | p, |
Z_OPACRecord * | input_record, | ||
WRBUF | output_record | ||
) |
performs record conversion on OPAC record
p | record conversion handle |
input_record | Z39.50 OPAC record |
output_record | resultint record (WRBUF string) |
0 | success |
-1 | failure |
On failure, use yaz_record_conv_get_error to get error string.
Definition at line 1240 of file record_conv.c.
References yaz_record_conv_type::construct, construct_marc(), yaz_record_conv_rule::info, marc_info::input_charset, marc_info::leader_spec, yaz_record_conv_rule::next, marc_info::output_format_mode, yaz_record_conv_struct::rules, yaz_record_conv_rule::type, yaz_record_conv_struct::wr_error, wrbuf_alloc(), wrbuf_buf, wrbuf_destroy(), wrbuf_len, wrbuf_puts(), wrbuf_rewind(), yaz_iconv_close(), yaz_iconv_open(), yaz_marc_create(), yaz_marc_destroy(), yaz_marc_iconv(), yaz_marc_leader_spec(), yaz_marc_xml(), yaz_opac_check_marc21_coding(), yaz_opac_decode_wrbuf(), and yaz_record_conv_record_rule().
Referenced by retrieve_fetch().
int yaz_record_conv_record | ( | yaz_record_conv_t | p, |
const char * | input_record_buf, | ||
size_t | input_record_len, | ||
WRBUF | output_record | ||
) |
performs record conversion on record buffer (OCTET aligned)
p | record conversion handle |
input_record_buf | input record buffer |
input_record_len | length of input record buffer |
output_record | resultint record (WRBUF string) |
0 | success |
-1 | failure |
On failure, use yaz_record_conv_get_error to get error string.
Definition at line 1288 of file record_conv.c.
References yaz_record_conv_struct::rules, and yaz_record_conv_record_rule().
Referenced by retrieve_fetch().
void yaz_record_conv_set_path | ( | yaz_record_conv_t | p, |
const char * | path | ||
) |
set path for opening stylesheets etc.
p | record conversion handle |
path | file path (UNIX style with : / Windows with ;) |
Definition at line 1303 of file record_conv.c.
References yaz_record_conv_struct::path, xfree, and xstrdup.
Referenced by conf_retrieval().
const char* yaz_record_get_output_charset | ( | yaz_record_conv_t | p | ) |
get output charset for last marc rule
p | record conversion handle |
Definition at line 1229 of file record_conv.c.
References yaz_record_conv_type::construct, construct_marc(), yaz_record_conv_rule::info, marc_info::output_charset, yaz_record_conv_struct::rules, and yaz_record_conv_rule::type.
Referenced by retrieve_fetch().