IDZEBRA  2.1.2
Data Structures | Macros | Enumerations | Functions | Variables
mod_dom.c File Reference
#include <stdio.h>
#include <assert.h>
#include <ctype.h>
#include <stdarg.h>
#include <yaz/diagbib1.h>
#include <yaz/tpath.h>
#include <yaz/snprintf.h>
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxml/xmlIO.h>
#include <libxml/xmlreader.h>
#include <libxslt/transform.h>
#include <libxslt/xsltutils.h>
#include <idzebra/util.h>
#include <idzebra/recctrl.h>
#include <yaz/oid_db.h>

Go to the source code of this file.

Data Structures

struct  convert_xslt
 
struct  convert_meta
 
struct  convert_s
 
struct  filter_extract
 
struct  filter_store
 
struct  filter_retrieve
 
struct  filter_input
 
struct  filter_info
 

Macros

#define ZEBRA_DOM_NS   "http://indexdata.com/zebra-2.0"
 
#define ZEBRA_PI_NAME   "zebra-2.0"
 
#define DOM_INPUT_XMLREADER   1
 
#define DOM_INPUT_MARC   2
 
#define XML_STRCMP(a, b)   strcmp((char*)a, b)
 
#define XML_STRLEN(a)   strlen((char*)a)
 
#define FOR_EACH_ELEMENT(ptr)   for (; ptr; ptr = ptr->next) if (ptr->type == XML_ELEMENT_NODE)
 

Enumerations

enum  convert_type { convert_xslt_type, convert_meta_type }
 

Functions

static void dom_log (int level, struct filter_info *tinfo, xmlNodePtr ptr, const char *fmt,...)
 
static void set_param_str (const char **params, const char *name, const char *value, NMEM nmem)
 
static void set_param_int (const char **params, const char *name, zint value, NMEM nmem)
 
static void * filter_init (Res res, RecType recType)
 
static int attr_content (struct _xmlAttr *attr, const char *name, const char **dst_content)
 
static void destroy_xsp (struct convert_s *c)
 
static void destroy_dom (struct filter_info *tinfo)
 
static ZEBRA_RES parse_convert (struct filter_info *tinfo, xmlNodePtr ptr, struct convert_s **l)
 
static int process_meta (struct filter_info *tinfo, xmlDocPtr doc, xmlNodePtr node, struct recRetrieveCtrl *retctr)
 
static ZEBRA_RES perform_convert (struct filter_info *tinfo, struct recExtractCtrl *extctr, struct recRetrieveCtrl *retctr, struct convert_s *convert, const char **params, xmlDocPtr *doc, xsltStylesheetPtr *last_xsp)
 
static struct filter_inputnew_input (struct filter_info *tinfo, int type)
 
static ZEBRA_RES parse_input (struct filter_info *tinfo, xmlNodePtr ptr, const char *syntax, const char *name)
 
static ZEBRA_RES parse_dom (struct filter_info *tinfo, const char *fname)
 
static struct filter_retrievelookup_retrieve (struct filter_info *tinfo, const char *est)
 
static ZEBRA_RES filter_config (void *clientData, Res res, const char *args)
 
static void filter_destroy (void *clientData)
 
static int ioread_ex (void *context, char *buffer, int len)
 
static int ioclose_ex (void *context)
 
static void index_value_of (struct filter_info *tinfo, struct recExtractCtrl *extctr, RecWord *recword, xmlNodePtr node, const char *index_p)
 
static void set_record_info (struct filter_info *tinfo, struct recExtractCtrl *extctr, xmlNodePtr node, const char *id_p, const char *rank_p, const char *type_p)
 
static void process_xml_element_node (struct filter_info *tinfo, struct recExtractCtrl *extctr, RecWord *recword, xmlNodePtr node)
 
static void process_xml_element_zebra_node (struct filter_info *tinfo, struct recExtractCtrl *extctr, RecWord *recword, xmlNodePtr node)
 
static int attr_content_pi (const char **c_ptr, const char *name, char *value, size_t value_max)
 
static void process_xml_pi_node (struct filter_info *tinfo, struct recExtractCtrl *extctr, xmlNodePtr node, const char **index_pp)
 
static void extract_dom_doc_node (struct filter_info *tinfo, struct recExtractCtrl *extctr, xmlDocPtr doc)
 
static int convert_extract_doc (struct filter_info *tinfo, struct filter_input *input, struct recExtractCtrl *p, xmlDocPtr doc)
 
static int extract_xml_split (struct filter_info *tinfo, struct filter_input *input, struct recExtractCtrl *p)
 
static int extract_xml_full (struct filter_info *tinfo, struct filter_input *input, struct recExtractCtrl *p)
 
static int extract_iso2709 (struct filter_info *tinfo, struct filter_input *input, struct recExtractCtrl *p)
 
static int filter_extract (void *clientData, struct recExtractCtrl *p)
 
static int ioread_ret (void *context, char *buffer, int len)
 
static int ioclose_ret (void *context)
 
static int filter_retrieve (void *clientData, struct recRetrieveCtrl *p)
 

Variables

static const char * zebra_dom_ns = ZEBRA_DOM_NS
 
static const char * zebra_pi_name = ZEBRA_PI_NAME
 
static struct recType filter_type
 
RecType idzebra_filter []
 

Macro Definition Documentation

#define DOM_INPUT_MARC   2

Definition at line 96 of file mod_dom.c.

Referenced by destroy_dom(), filter_extract(), and parse_input().

#define DOM_INPUT_XMLREADER   1

Definition at line 95 of file mod_dom.c.

Referenced by destroy_dom(), filter_extract(), parse_dom(), and parse_input().

#define FOR_EACH_ELEMENT (   ptr)    for (; ptr; ptr = ptr->next) if (ptr->type == XML_ELEMENT_NODE)

Definition at line 136 of file mod_dom.c.

Referenced by parse_convert(), parse_dom(), and parse_input().

#define XML_STRCMP (   a,
 
)    strcmp((char*)a, b)
#define XML_STRLEN (   a)    strlen((char*)a)

Definition at line 133 of file mod_dom.c.

#define ZEBRA_DOM_NS   "http://indexdata.com/zebra-2.0"

Definition at line 49 of file mod_dom.c.

#define ZEBRA_PI_NAME   "zebra-2.0"

Definition at line 53 of file mod_dom.c.

Enumeration Type Documentation

Enumerator
convert_xslt_type 
convert_meta_type 

Definition at line 56 of file mod_dom.c.

Function Documentation

static int attr_content ( struct _xmlAttr *  attr,
const char *  name,
const char **  dst_content 
)
static

Definition at line 212 of file mod_dom.c.

References XML_STRCMP.

Referenced by parse_convert(), parse_dom(), parse_input(), process_meta(), and process_xml_element_zebra_node().

static int attr_content_pi ( const char **  c_ptr,
const char *  name,
char *  value,
size_t  value_max 
)
static

Definition at line 1084 of file mod_dom.c.

Referenced by process_xml_pi_node().

static int convert_extract_doc ( struct filter_info tinfo,
struct filter_input input,
struct recExtractCtrl p,
xmlDocPtr  doc 
)
static
static void destroy_dom ( struct filter_info tinfo)
static
static void destroy_xsp ( struct convert_s c)
static
static void dom_log ( int  level,
struct filter_info tinfo,
xmlNodePtr  ptr,
const char *  fmt,
  ... 
)
static
static void extract_dom_doc_node ( struct filter_info tinfo,
struct recExtractCtrl extctr,
xmlDocPtr  doc 
)
static

Definition at line 1216 of file mod_dom.c.

References recExtractCtrl::init, and process_xml_element_node().

Referenced by convert_extract_doc().

static int extract_iso2709 ( struct filter_info tinfo,
struct filter_input input,
struct recExtractCtrl p 
)
static
static int extract_xml_full ( struct filter_info tinfo,
struct filter_input input,
struct recExtractCtrl p 
)
static
static int extract_xml_split ( struct filter_info tinfo,
struct filter_input input,
struct recExtractCtrl p 
)
static
static ZEBRA_RES filter_config ( void *  clientData,
Res  res,
const char *  args 
)
static
static void filter_destroy ( void *  clientData)
static

Definition at line 786 of file mod_dom.c.

References destroy_dom(), filter_info::nmem_config, and filter_info::nmem_record.

static int filter_extract ( void *  clientData,
struct recExtractCtrl p 
)
static
static void* filter_init ( Res  res,
RecType  recType 
)
static
static int filter_retrieve ( void *  clientData,
struct recRetrieveCtrl p 
)
static
static void index_value_of ( struct filter_info tinfo,
struct recExtractCtrl extctr,
RecWord recword,
xmlNodePtr  node,
const char *  index_p 
)
static
static int ioclose_ex ( void *  context)
static

Definition at line 801 of file mod_dom.c.

Referenced by extract_xml_full(), and extract_xml_split().

static int ioclose_ret ( void *  context)
static

Definition at line 1496 of file mod_dom.c.

Referenced by filter_retrieve().

static int ioread_ex ( void *  context,
char *  buffer,
int  len 
)
static

Definition at line 795 of file mod_dom.c.

References ZebraRecStream::readf, and recExtractCtrl::stream.

Referenced by extract_xml_full(), and extract_xml_split().

static int ioread_ret ( void *  context,
char *  buffer,
int  len 
)
static

Definition at line 1489 of file mod_dom.c.

References ZebraRecStream::readf, and recRetrieveCtrl::stream.

Referenced by filter_retrieve().

static struct filter_retrieve* lookup_retrieve ( struct filter_info tinfo,
const char *  est 
)
static
static struct filter_input* new_input ( struct filter_info tinfo,
int  type 
)
static
static ZEBRA_RES parse_convert ( struct filter_info tinfo,
xmlNodePtr  ptr,
struct convert_s **  l 
)
static
static ZEBRA_RES parse_dom ( struct filter_info tinfo,
const char *  fname 
)
static
static ZEBRA_RES parse_input ( struct filter_info tinfo,
xmlNodePtr  ptr,
const char *  syntax,
const char *  name 
)
static
static ZEBRA_RES perform_convert ( struct filter_info tinfo,
struct recExtractCtrl extctr,
struct recRetrieveCtrl retctr,
struct convert_s convert,
const char **  params,
xmlDocPtr *  doc,
xsltStylesheetPtr *  last_xsp 
)
static
static int process_meta ( struct filter_info tinfo,
xmlDocPtr  doc,
xmlNodePtr  node,
struct recRetrieveCtrl retctr 
)
static
static void process_xml_element_node ( struct filter_info tinfo,
struct recExtractCtrl extctr,
RecWord recword,
xmlNodePtr  node 
)
static
static void process_xml_element_zebra_node ( struct filter_info tinfo,
struct recExtractCtrl extctr,
RecWord recword,
xmlNodePtr  node 
)
static
static void process_xml_pi_node ( struct filter_info tinfo,
struct recExtractCtrl extctr,
xmlNodePtr  node,
const char **  index_pp 
)
static

Definition at line 1112 of file mod_dom.c.

References attr_content_pi(), dom_log(), set_record_info(), and zebra_pi_name.

Referenced by process_xml_element_node().

static void set_param_int ( const char **  params,
const char *  name,
zint  value,
NMEM  nmem 
)
static

Definition at line 178 of file mod_dom.c.

References ZINT_FORMAT.

Referenced by filter_retrieve().

static void set_param_str ( const char **  params,
const char *  name,
const char *  value,
NMEM  nmem 
)
static

Definition at line 166 of file mod_dom.c.

Referenced by convert_extract_doc(), and filter_retrieve().

static void set_record_info ( struct filter_info tinfo,
struct recExtractCtrl extctr,
xmlNodePtr  node,
const char *  id_p,
const char *  rank_p,
const char *  type_p 
)
static

Variable Documentation

struct recType filter_type
static
Initial value:
= {
0,
"dom",
}
static void * filter_init(Res res, RecType recType)
Definition: mod_dom.c:190
static int filter_extract(void *clientData, struct recExtractCtrl *p)
Definition: mod_dom.c:1463
static ZEBRA_RES filter_config(void *clientData, Res res, const char *args)
Definition: mod_dom.c:768
static void filter_destroy(void *clientData)
Definition: mod_dom.c:786

Definition at line 1614 of file mod_dom.c.

RecType idzebra_filter[]
Initial value:
= {
0,
}
static struct recType filter_type
Definition: mod_dom.c:1614

Definition at line 1631 of file mod_dom.c.

const char* zebra_dom_ns = ZEBRA_DOM_NS
static

Definition at line 50 of file mod_dom.c.

Referenced by convert_extract_doc(), process_meta(), and process_xml_element_zebra_node().

const char* zebra_pi_name = ZEBRA_PI_NAME
static

Definition at line 54 of file mod_dom.c.

Referenced by process_xml_pi_node().