32 #include "gnc-xml-helper.h"
38 typedef gboolean (*sixtp_start_handler)(GSList* sibling_data,
41 gpointer *data_for_children,
46 typedef gboolean (*sixtp_before_child_handler)(gpointer data_for_children,
47 GSList* data_from_children,
53 const gchar *child_tag);
55 typedef gboolean (*sixtp_after_child_handler)(gpointer data_for_children,
56 GSList* data_from_children,
62 const gchar *child_tag,
65 typedef gboolean (*sixtp_end_handler)(gpointer data_for_children,
66 GSList* data_from_children,
73 typedef gboolean (*sixtp_characters_handler)(GSList *sibling_data,
82 typedef void (*sixtp_fail_handler)(gpointer data_for_children,
83 GSList* data_from_children,
90 typedef void (*sixtp_push_handler)(xmlParserCtxtPtr xml_context,
96 sixtp_start_handler start_handler;
97 sixtp_before_child_handler before_child;
98 sixtp_after_child_handler after_child;
99 sixtp_end_handler end_handler;
100 sixtp_characters_handler characters_handler;
102 sixtp_fail_handler fail_handler;
105 sixtp_result_handler cleanup_result;
106 sixtp_result_handler cleanup_chars;
108 sixtp_result_handler result_fail_handler;
111 sixtp_result_handler chars_fail_handler;
115 GHashTable *child_parsers;
120 SIXTP_NO_MORE_HANDLERS,
122 SIXTP_START_HANDLER_ID,
123 SIXTP_BEFORE_CHILD_HANDLER_ID,
124 SIXTP_AFTER_CHILD_HANDLER_ID,
125 SIXTP_END_HANDLER_ID,
126 SIXTP_CHARACTERS_HANDLER_ID,
128 SIXTP_FAIL_HANDLER_ID,
130 SIXTP_CLEANUP_RESULT_ID,
131 SIXTP_CLEANUP_CHARS_ID,
133 SIXTP_RESULT_FAIL_ID,
136 } sixtp_handler_type;
139 #define SIXTP_MAGIC_CATCHER "&MAGIX&"
143 SIXTP_CHILD_RESULT_CHARS,
144 SIXTP_CHILD_RESULT_NODE
145 } sixtp_child_result_type;
149 sixtp_child_result_type type;
152 gboolean should_cleanup;
153 sixtp_result_handler cleanup_handler;
154 sixtp_result_handler fail_handler;
161 gpointer global_data;
162 xmlParserCtxtPtr saxParserCtxt;
163 sixtp *bad_xml_parser;
173 void sixtp_sax_start_handler(
void *user_data,
const xmlChar *name,
174 const xmlChar **attrs);
175 void sixtp_sax_characters_handler(
void *user_data,
const xmlChar *text,
177 void sixtp_sax_end_handler(
void *user_data,
const xmlChar *name);
179 sixtp* sixtp_new(
void);
180 void sixtp_destroy(
sixtp *sp);
183 xmlEntityPtr sixtp_sax_get_entity_handler(
void *user_data,
const xmlChar *name);
185 gboolean sixtp_parse_file(
sixtp *
sixtp,
const char *filename,
186 gpointer data_for_top_level, gpointer global_data,
187 gpointer *parse_result);
188 gboolean sixtp_parse_fd(
sixtp *
sixtp, FILE *fd,
189 gpointer data_for_top_level, gpointer global_data,
190 gpointer *parse_result);
191 gboolean sixtp_parse_buffer(
sixtp *
sixtp,
char *bufp,
int bufsz,
192 gpointer data_for_top_level, gpointer global_data,
193 gpointer *parse_result);
194 gboolean sixtp_parse_push(
sixtp *
sixtp, sixtp_push_handler push_handler,
195 gpointer push_user_data, gpointer data_for_top_level,
196 gpointer global_data, gpointer *parse_result);
198 void sixtp_set_start(
sixtp *parser, sixtp_start_handler start_handler);
199 void sixtp_set_before_child(
sixtp *parser, sixtp_before_child_handler handler);
200 void sixtp_set_after_child(
sixtp *parser, sixtp_after_child_handler handler);
201 void sixtp_set_end(
sixtp *parser, sixtp_end_handler end_handler);
202 void sixtp_set_chars(
sixtp *parser, sixtp_characters_handler char_handler);
203 void sixtp_set_cleanup_result(
sixtp *parser, sixtp_result_handler handler);
204 void sixtp_set_cleanup_chars(
sixtp *parser, sixtp_result_handler handler);
205 void sixtp_set_fail(
sixtp *parser, sixtp_fail_handler handler);
206 void sixtp_set_result_fail(
sixtp *parser, sixtp_result_handler handler);
207 void sixtp_set_chars_fail(
sixtp *parser, sixtp_result_handler handler);
209 sixtp* sixtp_set_any(
sixtp *tochange, gboolean cleanup, ...);
210 sixtp* sixtp_add_some_sub_parsers(
sixtp *tochange, gboolean cleanup, ...);
212 gboolean sixtp_add_sub_parser(
sixtp *parser,
const gchar* tag,
215 QofBookFileType gnc_is_our_xml_file(
const char *filename,
216 gboolean *with_encoding);
218 QofBookFileType gnc_is_our_first_xml_chunk(
char *chunk, gboolean *with_encoding);
All type declarations for the whole Gnucash engine.
load and save data to files