CUBRID Engine  latest
xml_parser.c File Reference
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include "xml_parser.h"
#include "utility.h"
Include dependency graph for xml_parser.c:

Go to the source code of this file.

Macros

#define XML_READ_BUFFSIZE   8192
 
#define XML_ROOT_DEPTH   0
 
#define IS_XML_ROOT(el)   (el->def->depth == XML_ROOT_DEPTH)
 

Enumerations

enum  XML_INS_POS { XML_INS_POS_UNDEF = 0, XML_INS_POS_AFTER, XML_INS_POS_BEFORE }
 

Functions

static XML_ELEMENTxml_init_schema_tree (XML_ELEMENT_DEF **element_array, const int count)
 
static void xml_destroy_schema_tree (XML_ELEMENT *pt)
 
static XML_ELEMENTxml_clone_node (XML_ELEMENT *schema_src, XML_ELEMENT *parent, XML_ELEMENT *prev, bool *has_error)
 
static bool xml_copy_schema_tree (XML_ELEMENT *src, XML_ELEMENT **dest)
 
static XML_ELEMENTcreate_xml_node (XML_ELEMENT_DEF *new_elem)
 
static int add_xml_element (XML_ELEMENT *xml_node, XML_ELEMENT_DEF *new_elem_def)
 
static XML_ELEMENTselect_xml_branch_node (XML_ELEMENT *xml_node, const char *sel_name)
 
static XML_ELEMENTselect_xml_node_for_ins (XML_ELEMENT *xml_node, const char *sel_name, XML_INS_POS *insert_pos)
 
static char * get_elem_path_token_at (const XML_ELEMENT_DEF *el_def, const int level, char *short_name)
 
static const char * get_short_elem_name (const XML_ELEMENT_DEF *el_def)
 
static int check_xml_elem_name (XML_ELEMENT *el, const char *check_el_name)
 
static void XMLCALL xml_header_validation_utf8 (void *userData, const XML_Char *version, const XML_Char *encoding, int standalone)
 
static void XMLCALL xml_elem_start (void *data, const char *parsed_el_name, const char **attr)
 
static void XMLCALL xml_elem_end (void *data, const char *parsed_el_name)
 
static void XMLCALL xml_data_handler (void *data, const XML_Char *s, int len)
 
static XML_Parser xml_init_parser_common (void *data, const char *xml_file, const char *encoding)
 
static int xml_parse (void *data, FILE *fp, bool *is_finished)
 
static bool xml_check_include_loop (XML_PARSER_DATA *pd, char *new_file)
 
XML_Parser xml_init_parser (void *data, const char *xml_file, const char *encoding, XML_ELEMENT_DEF **element_array, const int count)
 
void xml_destroy_parser (void *data)
 
XML_PARSER_DATAxml_create_subparser (XML_PARSER_DATA *pd, char *new_file)
 
void xml_destroy_parser_data (void *data)
 
int xml_check_att_value (const char **attrs, const char *att_name, const char *att_value)
 
int xml_get_att_value (const char **attrs, const char *att_name, char **p_att_value)
 
void xml_parser_exec (XML_PARSER_DATA *pd)
 

Variables

XML_ELEMENT_DEF xml_elem_XML = { "XML", XML_ROOT_DEPTH, NULL, NULL, NULL }
 

Macro Definition Documentation

#define IS_XML_ROOT (   el)    (el->def->depth == XML_ROOT_DEPTH)

Definition at line 46 of file xml_parser.c.

Referenced by add_xml_element(), and xml_elem_start().

#define XML_READ_BUFFSIZE   8192

Definition at line 41 of file xml_parser.c.

Referenced by xml_init_parser_common(), and xml_parse().

#define XML_ROOT_DEPTH   0

Definition at line 44 of file xml_parser.c.

Enumeration Type Documentation

Enumerator
XML_INS_POS_UNDEF 
XML_INS_POS_AFTER 
XML_INS_POS_BEFORE 

Definition at line 48 of file xml_parser.c.

Function Documentation

static int check_xml_elem_name ( XML_ELEMENT el,
const char *  check_el_name 
)
static

Definition at line 593 of file xml_parser.c.

References assert, NULL, and xml_element::short_name.

Referenced by add_xml_element(), select_xml_branch_node(), select_xml_node_for_ins(), and xml_elem_start().

Here is the caller graph for this function:

static XML_ELEMENT * create_xml_node ( XML_ELEMENT_DEF new_elem)
static

Definition at line 225 of file xml_parser.c.

References xml_element::child, xml_element::def, xml_element::match, xml_element::next, NULL, xml_element::parent, xml_element::prev, and xml_element::short_name.

Referenced by add_xml_element().

Here is the caller graph for this function:

static char * get_elem_path_token_at ( const XML_ELEMENT_DEF el_def,
const int  level,
char *  short_name 
)
static

Definition at line 516 of file xml_parser.c.

References assert, xml_element_def::full_name, NULL, and strlen.

Referenced by add_xml_element().

Here is the caller graph for this function:

static const char * get_short_elem_name ( const XML_ELEMENT_DEF el_def)
static

Definition at line 562 of file xml_parser.c.

References assert, xml_element_def::full_name, and NULL.

Referenced by add_xml_element().

Here is the caller graph for this function:

static XML_ELEMENT * select_xml_branch_node ( XML_ELEMENT xml_node,
const char *  sel_name 
)
static

Definition at line 415 of file xml_parser.c.

References assert, check_xml_elem_name(), xml_element::next, and NULL.

Referenced by add_xml_element().

Here is the caller graph for this function:

static XML_ELEMENT * select_xml_node_for_ins ( XML_ELEMENT xml_node,
const char *  sel_name,
XML_INS_POS insert_pos 
)
static

Definition at line 466 of file xml_parser.c.

References assert, check_xml_elem_name(), xml_element::next, NULL, XML_INS_POS_AFTER, and XML_INS_POS_BEFORE.

Referenced by add_xml_element().

Here is the caller graph for this function:

int xml_check_att_value ( const char **  attrs,
const char *  att_name,
const char *  att_value 
)

Definition at line 1152 of file xml_parser.c.

References assert, and NULL.

Referenced by start_calendar(), start_calendar_name_context(), start_dayPeriodWidth(), start_month_day_Width(), and start_numbers_symbols().

Here is the caller graph for this function:

static bool xml_check_include_loop ( XML_PARSER_DATA pd,
char *  new_file 
)
static

Definition at line 1215 of file xml_parser.c.

References xml_parser_data::filepath, NULL, and xml_parser_data::prev.

Referenced by xml_create_subparser().

Here is the caller graph for this function:

static XML_ELEMENT * xml_clone_node ( XML_ELEMENT schema_src,
XML_ELEMENT parent,
XML_ELEMENT prev,
bool has_error 
)
static

Definition at line 158 of file xml_parser.c.

References xml_element::child, xml_element::def, xml_element::match, xml_element::next, NULL, xml_element::parent, xml_element::prev, and xml_element::short_name.

Referenced by xml_copy_schema_tree().

Here is the caller graph for this function:

static bool xml_copy_schema_tree ( XML_ELEMENT src,
XML_ELEMENT **  dest 
)
static

Definition at line 210 of file xml_parser.c.

References NULL, and xml_clone_node().

Referenced by xml_create_subparser().

Here is the caller graph for this function:

static void XMLCALL xml_data_handler ( void *  data,
const XML_Char *  s,
int  len 
)
static
void xml_destroy_parser ( void *  data)

Definition at line 977 of file xml_parser.c.

References xml_parser_data::next, NULL, and xml_destroy_parser_data().

Referenced by locale_compile_locale(), and tzc_summary().

Here is the caller graph for this function:

void xml_destroy_parser_data ( void *  data)

Definition at line 1067 of file xml_parser.c.

References xml_parser_data::buf, NULL, xml_parser_data::sc, xml_destroy_schema_tree(), and xml_parser_data::xml_parser.

Referenced by start_include_collation(), xml_create_subparser(), and xml_destroy_parser().

Here is the caller graph for this function:

static void xml_destroy_schema_tree ( XML_ELEMENT pt)
static

Definition at line 127 of file xml_parser.c.

References assert, xml_element::child, xml_element::def, xml_element::next, NULL, xml_element::parent, xml_element::prev, and xml_element::short_name.

Referenced by xml_create_subparser(), and xml_destroy_parser_data().

Here is the caller graph for this function:

static void XMLCALL xml_elem_end ( void *  data,
const char *  parsed_el_name 
)
static
int xml_get_att_value ( const char **  attrs,
const char *  att_name,
char **  p_att_value 
)
static void XMLCALL xml_header_validation_utf8 ( void *  userData,
const XML_Char *  version,
const XML_Char *  encoding,
int  standalone 
)
static
XML_Parser xml_init_parser ( void *  data,
const char *  xml_file,
const char *  encoding,
XML_ELEMENT_DEF **  element_array,
const int  count 
)
static XML_ELEMENT * xml_init_schema_tree ( XML_ELEMENT_DEF **  element_array,
const int  count 
)
static
static int xml_parse ( void *  data,
FILE *  fp,
bool is_finished 
)
static
void xml_parser_exec ( XML_PARSER_DATA pd)

Variable Documentation

XML_ELEMENT_DEF xml_elem_XML = { "XML", XML_ROOT_DEPTH, NULL, NULL, NULL }

Definition at line 81 of file xml_parser.c.

Referenced by xml_init_schema_tree().