YAZ  5.34.0
Data Structures | Macros | Functions
marc_read_sax.c File Reference

Implements reading of MARCXML using SAX parsing. More...

#include <stdio.h>
#include <yaz/log.h>
#include <yaz/marc_sax.h>
#include <yaz/wrbuf.h>
#include <yaz/nmem_xml.h>

Go to the source code of this file.

Data Structures

struct  yaz_marc_sax_t_
 

Macros

#define MAX_IND   9
 

Functions

static int get_attribute (const char *name, int nb_attributes, const xmlChar **attributes, WRBUF result)
 
static void get_indicators (yaz_marc_sax_t ctx, int nb_attributes, const xmlChar **attributes)
 
static void yaz_start_element_ns (void *vp, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI, int nb_namespaces, const xmlChar **namespaces, int nb_attributes, int nb_defaulted, const xmlChar **attributes)
 
static void yaz_end_element_ns (void *vp, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI)
 
static void yaz_characters (void *vp, const xmlChar *text, int len)
 
yaz_marc_sax_t yaz_marc_sax_new (yaz_marc_t mt, void(*cb)(yaz_marc_t, void *), void *cb_data)
 
xmlSAXHandlerPtr yaz_marc_sax_get_handler (yaz_marc_sax_t ctx)
 return Libxml SAX handler pointer More...
 
void yaz_marc_sax_destroy (yaz_marc_sax_t ctx)
 destroys marc SAX parser More...
 

Detailed Description

Implements reading of MARCXML using SAX parsing.

Definition in file marc_read_sax.c.

Macro Definition Documentation

◆ MAX_IND

#define MAX_IND   9

Definition at line 20 of file marc_read_sax.c.

Function Documentation

◆ get_attribute()

static int get_attribute ( const char *  name,
int  nb_attributes,
const xmlChar **  attributes,
WRBUF  result 
)
static

Definition at line 36 of file marc_read_sax.c.

References name, and wrbuf_putc.

Referenced by get_indicators(), and yaz_start_element_ns().

◆ get_indicators()

static void get_indicators ( yaz_marc_sax_t  ctx,
int  nb_attributes,
const xmlChar **  attributes 
)
static

◆ yaz_characters()

static void yaz_characters ( void *  vp,
const xmlChar *  text,
int  len 
)
static

Definition at line 135 of file marc_read_sax.c.

References yaz_marc_sax_t_::cdata, and wrbuf_write().

Referenced by yaz_marc_sax_new().

◆ yaz_end_element_ns()

static void yaz_end_element_ns ( void *  vp,
const xmlChar *  localname,
const xmlChar *  prefix,
const xmlChar *  URI 
)
static

◆ yaz_marc_sax_destroy()

void yaz_marc_sax_destroy ( yaz_marc_sax_t  ctx)

destroys marc SAX parser

Parameters
ctx

Definition at line 164 of file marc_read_sax.c.

References yaz_marc_sax_t_::cdata, yaz_marc_sax_t_::indicators, yaz_marc_sax_t_::tag, wrbuf_destroy(), and xfree.

◆ yaz_marc_sax_get_handler()

xmlSAXHandlerPtr yaz_marc_sax_get_handler ( yaz_marc_sax_t  ctx)

return Libxml SAX handler pointer

Returns
pointer

Definition at line 159 of file marc_read_sax.c.

References yaz_marc_sax_t_::saxHandler.

◆ yaz_marc_sax_new()

yaz_marc_sax_t yaz_marc_sax_new ( yaz_marc_t  mt,
void(*)(yaz_marc_t, void *)  cb,
void *  cb_data 
)

◆ yaz_start_element_ns()

static void yaz_start_element_ns ( void *  vp,
const xmlChar *  localname,
const xmlChar *  prefix,
const xmlChar *  URI,
int  nb_namespaces,
const xmlChar **  namespaces,
int  nb_attributes,
int  nb_defaulted,
const xmlChar **  attributes 
)
static