~ubuntu-branches/ubuntu/quantal/mysql-workbench/quantal

« back to all changes in this revision

Viewing changes to library/sql-parser/source/my_xml.h

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2012-03-01 21:57:30 UTC
  • Revision ID: package-import@ubuntu.com-20120301215730-o7y8av8y38n162ro
Tags: upstream-5.2.38+dfsg
ImportĀ upstreamĀ versionĀ 5.2.38+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2000 MySQL AB
 
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 as published by
 
5
   the Free Software Foundation; either version 2 of the License, or
 
6
   (at your option) any later version.
 
7
 
 
8
   This program is distributed in the hope that it will be useful,
 
9
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
   GNU General Public License for more details.
 
12
 
 
13
   You should have received a copy of the GNU General Public License
 
14
   along with this program; if not, write to the Free Software
 
15
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  */
 
16
 
 
17
 
 
18
#ifndef _my_xml_h
 
19
#define _my_xml_h
 
20
 
 
21
namespace mysql_parser
 
22
{
 
23
 
 
24
//#ifdef        __cplusplus
 
25
//extern "C" {
 
26
//#endif
 
27
 
 
28
 
 
29
#define MY_XML_OK       0
 
30
#define MY_XML_ERROR    1
 
31
 
 
32
/* 
 
33
  A flag whether to use absolute tag names in call-back functions,
 
34
  like "a", "a.b" and "a.b.c" (used in character set file parser),
 
35
  or relative names like "a", "b" and "c".
 
36
*/
 
37
#define MY_XML_FLAG_RELATIVE_NAMES 1
 
38
 
 
39
/*
 
40
  A flag whether to skip normilization of text values before calling
 
41
  call-back functions: i.e. skip leading/trailing spaces,
 
42
  \r, \n, \t characters.
 
43
*/
 
44
#define MY_XML_FLAG_SKIP_TEXT_NORMALIZATION 2
 
45
 
 
46
enum my_xml_node_type
 
47
{
 
48
  MY_XML_NODE_TAG,   /* can have TAG, ATTR and TEXT children */
 
49
  MY_XML_NODE_ATTR,  /* can have TEXT children               */
 
50
  MY_XML_NODE_TEXT   /* cannot have children                 */
 
51
};
 
52
 
 
53
typedef struct xml_stack_st
 
54
{
 
55
  int flags;
 
56
  enum my_xml_node_type current_node_type;
 
57
  char errstr[128];
 
58
  char attr[128];
 
59
  char *attrend;
 
60
  const char *beg;
 
61
  const char *cur;
 
62
  const char *end;
 
63
  void *user_data;
 
64
  int  (*enter)(struct xml_stack_st *st,const char *val, uint len);
 
65
  int  (*value)(struct xml_stack_st *st,const char *val, uint len);
 
66
  int  (*leave_xml)(struct xml_stack_st *st,const char *val, uint len);
 
67
} MY_XML_PARSER;
 
68
 
 
69
void my_xml_parser_create(MY_XML_PARSER *st);
 
70
void my_xml_parser_free(MY_XML_PARSER *st);
 
71
int  my_xml_parse(MY_XML_PARSER *st,const char *str, uint len);
 
72
 
 
73
void my_xml_set_value_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *,
 
74
                                                         const char *,
 
75
                                                         uint len));
 
76
void my_xml_set_enter_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *,
 
77
                                                         const char *,
 
78
                                                         uint len));
 
79
void my_xml_set_leave_handler(MY_XML_PARSER *st, int (*)(MY_XML_PARSER *,
 
80
                                                         const char *,
 
81
                                                         uint len));
 
82
void my_xml_set_user_data(MY_XML_PARSER *st, void *);
 
83
 
 
84
uint my_xml_error_pos(MY_XML_PARSER *st);
 
85
uint my_xml_error_lineno(MY_XML_PARSER *st);
 
86
 
 
87
const char *my_xml_error_string(MY_XML_PARSER *st);
 
88
 
 
89
//#ifdef        __cplusplus
 
90
//}
 
91
//#endif
 
92
 
 
93
} // namespace mysql_parser
 
94
 
 
95
#endif /* _my_xml_h */