xml_GNode*
xml_g_markup_parse_text (const xml_GNode* mine,
const gchar* text, gsize off, gsize end,
const gchar* rootfilename, GError** error)
{
static const GMarkupParser parser =
{
.start_element = xml_g_on_start_element,
.end_element = xml_g_on_end_element,
.text = xml_g_on_text,
.passthrough = xml_g_on_passthrough,
.error = xml_g_on_error
} | ;
g_return_val_if_fail (! mine || mine->text, 0);
___ auto struct UserData user_data;
register gchar* s;
user_data.text = (mine) ? mine->text : g_string_new(0);
user_data.node = 0;
# if 0
user_data.node = xml_g_node_new_data (name);
user_data.node->text = user_data.text;
# endif
___ GMarkupParseContext* context =
g_markup_parse_context_new (&parser, 0, &user_data, 0);
if (rootfilename)
s = g_strconcat ("<: filename=\"", rootfilename, "\">", 0);
else
s = g_strdup ("<: >");
g_markup_parse_context_parse (context, s, -1, error); g_free (s);
g_markup_parse_context_parse (context, text+off, end-off, error);
g_markup_parse_context_parse (context, "</:>", 4, error);
g_markup_parse_context_end_parse (context, 0);
g_markup_parse_context_free (context);
____;
return user_data.node;
____;
} |
|