YAZ  5.34.0
Functions
xml_to_opac.c File Reference

Implements XML to OPAC conversion. More...

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <yaz/proto.h>
#include <yaz/marcdisp.h>
#include <yaz/wrbuf.h>
#include <yaz/oid_db.h>
#include "sru-p.h"

Go to the source code of this file.

Functions

static int match_element_next (xmlNode **ptr, const char *elem, NMEM nmem, char **val)
 
static int match_v_next (xmlNode **ptr, const char *elem, NMEM nmem, Odr_bool **val)
 
static int bibliographicRecord (yaz_marc_t mt, xmlNode *ptr, Z_External **ext, NMEM nmem, const Odr_oid *syntax)
 
static int volume (xmlNode *ptr, Z_Volume **volp, NMEM nmem)
 
static int volumes (xmlNode *ptr, Z_Volume ***volp, int *num, NMEM nmem)
 
static int circulation (xmlNode *ptr, Z_CircRecord **circp, NMEM nmem)
 
static int circulations (xmlNode *ptr, Z_CircRecord ***circp, int *num, NMEM nmem)
 
static int holdingsRecord (xmlNode *ptr, Z_HoldingsRecord **r, NMEM nmem)
 
static int yaz_xml_to_opac_ptr (yaz_marc_t mt, xmlNode *ptr, Z_OPACRecord **dst, NMEM nmem, const Odr_oid *syntax)
 
int yaz_xml_to_opac (yaz_marc_t mt, const char *buf_in, size_t size_in, Z_OPACRecord **dst, yaz_iconv_t cd, NMEM nmem, const Odr_oid *syntax)
 Converts XML to OPAC. More...
 

Detailed Description

Implements XML to OPAC conversion.

Definition in file xml_to_opac.c.

Function Documentation

◆ bibliographicRecord()

static int bibliographicRecord ( yaz_marc_t  mt,
xmlNode *  ptr,
Z_External **  ext,
NMEM  nmem,
const Odr_oid syntax 
)
static

◆ circulation()

static int circulation ( xmlNode *  ptr,
Z_CircRecord **  circp,
NMEM  nmem 
)
static

Definition at line 131 of file xml_to_opac.c.

References match_element_next(), match_v_next(), and nmem_malloc().

Referenced by circulations().

◆ circulations()

static int circulations ( xmlNode *  ptr,
Z_CircRecord ***  circp,
int *  num,
NMEM  nmem 
)
static

Definition at line 151 of file xml_to_opac.c.

References circulation(), nmem_malloc(), and yaz_match_xsd_element().

Referenced by holdingsRecord().

◆ holdingsRecord()

static int holdingsRecord ( xmlNode *  ptr,
Z_HoldingsRecord **  r,
NMEM  nmem 
)
static

◆ match_element_next()

static int match_element_next ( xmlNode **  ptr,
const char *  elem,
NMEM  nmem,
char **  val 
)
static

Definition at line 25 of file xml_to_opac.c.

References yaz_match_xsd_string_n_nmem().

Referenced by circulation(), holdingsRecord(), and volume().

◆ match_v_next()

static int match_v_next ( xmlNode **  ptr,
const char *  elem,
NMEM  nmem,
Odr_bool **  val 
)
static

Definition at line 39 of file xml_to_opac.c.

References nmem_booldup(), and yaz_match_xsd_element().

Referenced by circulation().

◆ volume()

static int volume ( xmlNode *  ptr,
Z_Volume **  volp,
NMEM  nmem 
)
static

Definition at line 89 of file xml_to_opac.c.

References match_element_next(), and nmem_malloc().

Referenced by volumes().

◆ volumes()

static int volumes ( xmlNode *  ptr,
Z_Volume ***  volp,
int *  num,
NMEM  nmem 
)
static

Definition at line 99 of file xml_to_opac.c.

References nmem_malloc(), volume(), and yaz_match_xsd_element().

Referenced by holdingsRecord().

◆ yaz_xml_to_opac()

int yaz_xml_to_opac ( yaz_marc_t  mt,
const char *  buf_in,
size_t  size_in,
Z_OPACRecord **  dst,
yaz_iconv_t  cd,
NMEM  nmem,
const Odr_oid syntax 
)

Converts XML to OPAC.

Parameters
mtmarc handle
buf_inXML buffer
size_insize of XML buffer
dstZ39.50 OPAC result - allocated by NMEM on marc handle
cdiconv handle for the OPAC content (not ISO2709 part)
nmemmemory for OPACRecord (if NULL, mt NMEM memory is used)
syntaxOID for embedded MARC (if NULL, USMARC is used)
Return values
1conversion OK
0conversion NOT OK \

Definition at line 299 of file xml_to_opac.c.

References yaz_marc_iconv(), and yaz_xml_to_opac_ptr().

Referenced by retrieve_fetch().

◆ yaz_xml_to_opac_ptr()

static int yaz_xml_to_opac_ptr ( yaz_marc_t  mt,
xmlNode *  ptr,
Z_OPACRecord **  dst,
NMEM  nmem,
const Odr_oid syntax 
)
static