MySQL 8.4.2
Source Code Documentation
|
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <limits>
#include "my_xml.h"
#include "string_with_len.h"
#include "strings/str_alloc.h"
Classes | |
struct | MY_XML_ATTR |
Macros | |
#define | MY_XML_UNKNOWN 'U' |
#define | MY_XML_EOF 'E' |
#define | MY_XML_STRING 'S' |
#define | MY_XML_IDENT 'I' |
#define | MY_XML_EQ '=' |
#define | MY_XML_LT '<' |
#define | MY_XML_GT '>' |
#define | MY_XML_SLASH '/' |
#define | MY_XML_COMMENT 'C' |
#define | MY_XML_TEXT 'T' |
#define | MY_XML_QUESTION '?' |
#define | MY_XML_EXCLAM '!' |
#define | MY_XML_CDATA 'D' |
#define | MY_XML_ID0 0x01 /* Identifier initial character */ |
#define | MY_XML_ID1 0x02 /* Identifier medial character */ |
#define | MY_XML_SPC 0x08 /* Spacing character */ |
#define | my_xml_is_space(c) (my_xml_ctype[(uint8_t)(c)] & MY_XML_SPC) |
#define | my_xml_is_id0(c) (my_xml_ctype[(uint8_t)(c)] & MY_XML_ID0) |
#define | my_xml_is_id1(c) (my_xml_ctype[(uint8_t)(c)] & MY_XML_ID1) |
Functions | |
static const char * | lex2str (int lex) |
static void | my_xml_norm_text (MY_XML_ATTR *a) |
static bool | my_xml_parser_prefix_cmp (MY_XML_PARSER *p, const char *s, size_t slen) |
static int | my_xml_scan (MY_XML_PARSER *p, MY_XML_ATTR *a) |
static int | my_xml_value (MY_XML_PARSER *st, const char *str, size_t len) |
static int | my_xml_attr_ensure_space (MY_XML_PARSER *st, size_t len) |
Ensure the attr buffer is wide enough to hold the new value. More... | |
static void | my_xml_attr_rewind (MY_XML_PARSER *p) |
rewind the attr buffer to initial state More... | |
static int | my_xml_enter (MY_XML_PARSER *st, const char *str, size_t len) |
static void | mstr (char *s, const char *src, size_t l1, size_t l2) |
static int | my_xml_leave (MY_XML_PARSER *p, const char *str, size_t slen) |
int | my_xml_parse (MY_XML_PARSER *p, const char *str, size_t len) |
void | my_xml_parser_create (MY_XML_PARSER *p) |
void | my_xml_parser_free (MY_XML_PARSER *p) |
void | my_xml_set_value_handler (MY_XML_PARSER *p, int(*action)(MY_XML_PARSER *p, const char *s, size_t l)) |
void | my_xml_set_enter_handler (MY_XML_PARSER *p, int(*action)(MY_XML_PARSER *p, const char *s, size_t l)) |
void | my_xml_set_leave_handler (MY_XML_PARSER *p, int(*action)(MY_XML_PARSER *p, const char *s, size_t l)) |
void | my_xml_set_user_data (MY_XML_PARSER *p, void *user_data) |
const char * | my_xml_error_string (MY_XML_PARSER *p) |
size_t | my_xml_error_pos (MY_XML_PARSER *p) |
unsigned | my_xml_error_lineno (MY_XML_PARSER *st) |
Variables | |
static char | my_xml_ctype [256] |
#define MY_XML_CDATA 'D' |
#define MY_XML_COMMENT 'C' |
#define MY_XML_EOF 'E' |
#define MY_XML_EQ '=' |
#define MY_XML_EXCLAM '!' |
#define MY_XML_GT '>' |
#define MY_XML_ID0 0x01 /* Identifier initial character */ |
#define MY_XML_ID1 0x02 /* Identifier medial character */ |
#define MY_XML_IDENT 'I' |
#define my_xml_is_id0 | ( | c | ) | (my_xml_ctype[(uint8_t)(c)] & MY_XML_ID0) |
#define my_xml_is_id1 | ( | c | ) | (my_xml_ctype[(uint8_t)(c)] & MY_XML_ID1) |
#define my_xml_is_space | ( | c | ) | (my_xml_ctype[(uint8_t)(c)] & MY_XML_SPC) |
#define MY_XML_LT '<' |
#define MY_XML_QUESTION '?' |
#define MY_XML_SLASH '/' |
#define MY_XML_SPC 0x08 /* Spacing character */ |
#define MY_XML_STRING 'S' |
#define MY_XML_TEXT 'T' |
#define MY_XML_UNKNOWN 'U' |
|
static |
|
static |
|
static |
Ensure the attr buffer is wide enough to hold the new value.
Expand and/or allocate dynamic buffer as needed to hold the concatenated path and the terminating zero.
st | the parser instance |
len | the length of the attribute to be added |
1 | failed |
0 | success |
|
static |
rewind the attr buffer to initial state
|
static |
unsigned my_xml_error_lineno | ( | MY_XML_PARSER * | st | ) |
size_t my_xml_error_pos | ( | MY_XML_PARSER * | p | ) |
const char * my_xml_error_string | ( | MY_XML_PARSER * | p | ) |
|
static |
|
static |
int my_xml_parse | ( | MY_XML_PARSER * | p, |
const char * | str, | ||
size_t | len | ||
) |
void my_xml_parser_create | ( | MY_XML_PARSER * | p | ) |
void my_xml_parser_free | ( | MY_XML_PARSER * | p | ) |
|
inlinestatic |
|
static |
void my_xml_set_enter_handler | ( | MY_XML_PARSER * | p, |
int(*)(MY_XML_PARSER *p, const char *s, size_t l) | action | ||
) |
void my_xml_set_leave_handler | ( | MY_XML_PARSER * | p, |
int(*)(MY_XML_PARSER *p, const char *s, size_t l) | action | ||
) |
void my_xml_set_user_data | ( | MY_XML_PARSER * | p, |
void * | user_data | ||
) |
void my_xml_set_value_handler | ( | MY_XML_PARSER * | p, |
int(*)(MY_XML_PARSER *p, const char *s, size_t l) | action | ||
) |
|
static |
|
static |