record_conv.h File Reference

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.

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_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)


Detailed Description

Record Conversions Utility.

Definition in file record_conv.h.


Typedef Documentation

record conversion handle

Definition at line 45 of file record_conv.h.


Function Documentation

int yaz_record_conv_configure ( yaz_record_conv_t  p,
const xmlNode *  node 
)

configures record conversion

Parameters:
p record conversion handle
node xmlNode pointer (root element of XML config)
Return values:
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 360 of file record_conv.c.

References yaz_record_conv_struct::wr_error, and wrbuf_printf().

yaz_record_conv_t yaz_record_conv_create ( void   ) 

void yaz_record_conv_destroy ( yaz_record_conv_t  p  ) 

destroys record handle

Parameters:
p record conversion handle

Definition at line 121 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(), and xfree.

const char* yaz_record_conv_get_error ( yaz_record_conv_t  p  ) 

returns error string (for last error)

Parameters:
p record conversion handle
Returns:
error string

Definition at line 562 of file record_conv.c.

References yaz_record_conv_struct::wr_error, and wrbuf_cstr().

int yaz_record_conv_opac_record ( yaz_record_conv_t  p,
Z_OPACRecord input_record,
WRBUF  output_record 
)

performs record conversion on OPAC record

Parameters:
p record conversion handle
input_record Z39.50 OPAC record
output_record resultint record (WRBUF string)
Return values:
0 success
-1 failure
On failure, use yaz_record_conv_get_error to get error string.

Definition at line 396 of file record_conv.c.

References yaz_record_conv_rule::marc, yaz_record_conv_rule::next, yaz_record_conv_struct::rules, yaz_record_conv_rule::u, yaz_record_conv_rule::which, yaz_record_conv_struct::wr_error, wrbuf_alloc(), wrbuf_buf, wrbuf_destroy(), wrbuf_len, wrbuf_rewind(), yaz_iconv_close(), yaz_iconv_open(), yaz_marc_create(), yaz_marc_destroy(), yaz_marc_iconv(), yaz_marc_xml(), yaz_opac_decode_wrbuf(), and YAZ_RECORD_CONV_RULE_MARC.

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)

Parameters:
p record conversion handle
input_record_buf input record buffer
input_record_len length of input record buffer
output_record resultint record (WRBUF string)
Return values:
0 success
-1 failure
On failure, use yaz_record_conv_get_error to get error string.

Definition at line 432 of file record_conv.c.

References yaz_record_conv_struct::rules.

void yaz_record_conv_set_path ( yaz_record_conv_t  p,
const char *  path 
)

set path for opening stylesheets etc.

Parameters:
p record conversion handle
path file path (UNIX style with : / Windows with ;)

Definition at line 567 of file record_conv.c.

References yaz_record_conv_struct::path, xfree, and xstrdup.


Generated on Wed Jun 18 11:17:03 2008 for YAZ by  doxygen 1.5.6