YAZ  5.23.1
Data Structures | Typedefs | Functions
xml_include.c File Reference

XML Include (not to be confused with W3C XInclude) More...

#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <yaz/wrbuf.h>
#include <yaz/tpath.h>
#include <yaz/log.h>
#include <yaz/xml_include.h>
#include <libxml/parser.h>
#include <libxml/tree.h>

Go to the source code of this file.

Data Structures

struct  yaz_xml_include_s
 

Typedefs

typedef struct yaz_xml_include_syaz_xml_include_t
 

Functions

static int process_config_includes (yaz_xml_include_t config, xmlNode *n)
 
static void conf_dir_path (yaz_xml_include_t config, WRBUF w, const char *src)
 
static int config_include_one (yaz_xml_include_t config, xmlNode **sib, const char *path)
 
static int config_include_src (yaz_xml_include_t config, xmlNode **np, const char *src)
 
int yaz_xml_include_glob (xmlNode *n, const char *base_path, unsigned glob_flags)
 substitute include nodes in a tree More...
 
int yaz_xml_include_simple (xmlNode *n, const char *base_path)
 substitute include nodes in a tree More...
 

Detailed Description

XML Include (not to be confused with W3C XInclude)

Definition in file xml_include.c.

Typedef Documentation

Definition at line 33 of file xml_include.c.

Function Documentation

static void conf_dir_path ( yaz_xml_include_t  config,
WRBUF  w,
const char *  src 
)
static

Definition at line 37 of file xml_include.c.

References yaz_xml_include_s::confdir, wrbuf_printf(), wrbuf_puts(), and yaz_is_abspath().

Referenced by config_include_src().

static int config_include_one ( yaz_xml_include_t  config,
xmlNode **  sib,
const char *  path 
)
static

Definition at line 48 of file xml_include.c.

References process_config_includes(), yaz_log(), YLOG_ERRNO, and YLOG_FATAL.

Referenced by config_include_src().

static int config_include_src ( yaz_xml_include_t  config,
xmlNode **  np,
const char *  src 
)
static
static int process_config_includes ( yaz_xml_include_t  config,
xmlNode *  n 
)
static

Definition at line 123 of file xml_include.c.

References config_include_src().

Referenced by config_include_one(), and yaz_xml_include_glob().

int yaz_xml_include_glob ( xmlNode *  n,
const char *  base_path,
unsigned  flags 
)

substitute include nodes in a tree

Parameters
nnode where include is performed
base_pathbase_path - for relative file specs
flagsfor yaz_file_glob2 (YAZ_FILE_GLOB_...)
Return values
0OK
-1FAILURE

Nodes of the form are substituted with contents of files matching glob-pattern. Do not use this function on XML from untrusted sources – from the net for example – local trusted XML configuration ONLY.

Definition at line 153 of file xml_include.c.

References yaz_xml_include_s::confdir, yaz_xml_include_s::glob_flags, and process_config_includes().

Referenced by yaz_xml_include_simple().

int yaz_xml_include_simple ( xmlNode *  n,
const char *  base_path 
)

substitute include nodes in a tree

Parameters
nnode where include is performed
base_pathbase_path - for relative file specs
Return values
0OK
-1FAILURE

Nodes of the form are substituted with contents of files matching glob-pattern. Do not use this function on XML from untrusted sources – from the net for example – local trusted XML configuration ONLY.

Definition at line 163 of file xml_include.c.

References yaz_xml_include_glob().