MySQL  8.0.27
Source Code Documentation
my_xml.h
Go to the documentation of this file.
1 /* Copyright (c) 2000, 2021, Oracle and/or its affiliates.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License, version 2.0,
5  as published by the Free Software Foundation.
6 
7  This program is also distributed with certain software (including
8  but not limited to OpenSSL) that is licensed under separate terms,
9  as designated in a particular file or component or in included license
10  documentation. The authors of MySQL hereby grant you an additional
11  permission to link the program and your derivative works with the
12  separately licensed software that they have included with MySQL.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License, version 2.0, for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef _my_xml_h
24 #define _my_xml_h
25 
26 /**
27  @file include/my_xml.h
28 */
29 
30 #include <stddef.h>
31 #include <sys/types.h>
32 
33 #define MY_XML_OK 0
34 #define MY_XML_ERROR 1
35 
36 /*
37  A flag whether to use absolute tag names in call-back functions,
38  like "a", "a.b" and "a.b.c" (used in character set file parser),
39  or relative names like "a", "b" and "c".
40 */
41 #define MY_XML_FLAG_RELATIVE_NAMES 1
42 
43 /*
44  A flag whether to skip normilization of text values before calling
45  call-back functions: i.e. skip leading/trailing spaces,
46  \r, \n, \t characters.
47 */
48 #define MY_XML_FLAG_SKIP_TEXT_NORMALIZATION 2
49 
51  MY_XML_NODE_TAG, /* can have TAG, ATTR and TEXT children */
52  MY_XML_NODE_ATTR, /* can have TEXT children */
53  MY_XML_NODE_TEXT /* cannot have children */
54 };
55 
56 struct MY_XML_PARSER {
57  int flags;
59  char errstr[128];
60 
61  struct {
62  char static_buffer[128];
63  char *buffer;
64  size_t buffer_size;
65  char *start;
66  char *end;
67  } attr;
68 
69  const char *beg;
70  const char *cur;
71  const char *end;
72  void *user_data;
73  int (*enter)(MY_XML_PARSER *st, const char *val, size_t len);
74  int (*value)(MY_XML_PARSER *st, const char *val, size_t len);
75  int (*leave_xml)(MY_XML_PARSER *st, const char *val, size_t len);
76 };
77 
80 int my_xml_parse(MY_XML_PARSER *st, const char *str, size_t len);
81 
83  int (*)(MY_XML_PARSER *, const char *,
84  size_t len));
86  int (*)(MY_XML_PARSER *, const char *,
87  size_t len));
89  int (*)(MY_XML_PARSER *, const char *,
90  size_t len));
91 void my_xml_set_user_data(MY_XML_PARSER *st, void *);
92 
95 
96 const char *my_xml_error_string(MY_XML_PARSER *st);
97 
98 #endif /* _my_xml_h */
void my_xml_parser_create(MY_XML_PARSER *st)
Definition: xml.cc:458
int my_xml_parse(MY_XML_PARSER *st, const char *str, size_t len)
Definition: xml.cc:325
void my_xml_set_leave_handler(MY_XML_PARSER *st, int(*)(MY_XML_PARSER *, const char *, size_t len))
void my_xml_set_value_handler(MY_XML_PARSER *st, int(*)(MY_XML_PARSER *, const char *, size_t len))
const char * my_xml_error_string(MY_XML_PARSER *st)
Definition: xml.cc:496
void my_xml_set_user_data(MY_XML_PARSER *st, void *)
Definition: xml.cc:492
void my_xml_set_enter_handler(MY_XML_PARSER *st, int(*)(MY_XML_PARSER *, const char *, size_t len))
void my_xml_parser_free(MY_XML_PARSER *st)
Definition: xml.cc:467
uint my_xml_error_lineno(MY_XML_PARSER *st)
Definition: xml.cc:510
my_xml_node_type
Definition: my_xml.h:50
@ MY_XML_NODE_TEXT
Definition: my_xml.h:53
@ MY_XML_NODE_ATTR
Definition: my_xml.h:52
@ MY_XML_NODE_TAG
Definition: my_xml.h:51
size_t my_xml_error_pos(MY_XML_PARSER *st)
Definition: xml.cc:498
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1056
Definition: my_xml.h:56
char * end
Definition: my_xml.h:66
char errstr[128]
Definition: my_xml.h:59
int(* enter)(MY_XML_PARSER *st, const char *val, size_t len)
Definition: my_xml.h:73
const char * cur
Definition: my_xml.h:70
enum my_xml_node_type current_node_type
Definition: my_xml.h:58
int flags
Definition: my_xml.h:57
const char * beg
Definition: my_xml.h:69
size_t buffer_size
Definition: my_xml.h:64
const char * end
Definition: my_xml.h:71
char * buffer
Definition: my_xml.h:63
char * start
Definition: my_xml.h:65
char static_buffer[128]
Definition: my_xml.h:62
int(* value)(MY_XML_PARSER *st, const char *val, size_t len)
Definition: my_xml.h:74
struct MY_XML_PARSER::@3 attr
int(* leave_xml)(MY_XML_PARSER *st, const char *val, size_t len)
Definition: my_xml.h:75
void * user_data
Definition: my_xml.h:72
unsigned int uint
Definition: uca-dump.cc:29