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

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

#include <yaz/yconfig.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>
#include <libxml/xinclude.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

◆ yaz_xml_include_t

Definition at line 45 of file xml_include.c.

Function Documentation

◆ conf_dir_path()

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

Definition at line 49 of file xml_include.c.

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

Referenced by config_include_src().

◆ config_include_one()

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

Definition at line 60 of file xml_include.c.

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

Referenced by config_include_src().

◆ config_include_src()

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

◆ process_config_includes()

static int process_config_includes ( yaz_xml_include_t  config,
xmlNode *  n 
)
static

Definition at line 145 of file xml_include.c.

References config_include_src().

Referenced by config_include_one(), and yaz_xml_include_glob().

◆ 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 175 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().

◆ 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 185 of file xml_include.c.

References yaz_xml_include_glob().