8 const gchar *element_name,
9 const gchar **attribute_names,
10 const gchar **attribute_values,
13 static void on_text(GMarkupParseContext *context,
18 static void on_error (GMarkupParseContext *context,
24 int main (
int rgc,
char** argv) {
27 GMarkupParseContext *gmpc = g_markup_parse_context_new(&gmp, 0, NULL, NULL);
29 GError* my_err = NULL;
30 GIOChannel *gioc = g_io_channel_new_file(
"b_bhi.xml",
"r", &my_err);
34 GIOStatus st = g_io_channel_read_chars(gioc, buf,
BUF_LEN, &bytes_read, &my_err);
38 if (!g_markup_parse_context_parse(gmpc, buf, bytes_read, &my_err)) {
39 g_message(
"error parsing xml");
48 const gchar *element_name,
49 const gchar **attribute_names,
50 const gchar **attribute_values,
54 if (!strcmp(element_name,
"pt")) {
57 while (attribute_names[i]) {
59 printf(
"%s ", attribute_values[i]);
60 if (!strcmp(attribute_names[i],
"on")) printf(
"\n");
66 static void on_text(GMarkupParseContext *context,
76 static void on_error (GMarkupParseContext *context,
static void on_error(GMarkupParseContext *context, GError *error, gpointer user_data)
int main(int rgc, char **argv)
static void on_text(GMarkupParseContext *context, const gchar *text, gsize text_len, gpointer user_data, GError **error)
static void on_start_element(GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer user_data, GError **error)