gdbus: Use g_markup_collect_known_attributes() in GDBus introspection

In order to be able to cope with the introspection XML
from the Telepathy specification, which uses attributes
like tp:type and tp:name-for-bindings, we need to ignore
unknown attributes when parsing.
Closes: https://bugzilla.gnome.org/show_bug.cgi?id=665634
This commit is contained in:
Matthias Clasen 2012-08-16 23:41:19 -04:00
parent 8d40389d15
commit 86329ba44f

View File

@ -1276,13 +1276,11 @@ parser_start_element (GMarkupParseContext *context,
goto out;
}
if (!g_markup_collect_attributes (element_name,
if (!g_markup_collect_known_attributes (element_name,
attribute_names,
attribute_values,
error,
G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL, "name", &name,
/* some hand-written introspection XML documents use this */
G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL, "xmlns:doc", NULL,
G_MARKUP_COLLECT_INVALID))
goto out;
@ -1315,13 +1313,11 @@ parser_start_element (GMarkupParseContext *context,
goto out;
}
if (!g_markup_collect_attributes (element_name,
if (!g_markup_collect_known_attributes (element_name,
attribute_names,
attribute_values,
error,
G_MARKUP_COLLECT_STRING, "name", &name,
/* seen in the wild */
G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL, "version", NULL,
G_MARKUP_COLLECT_INVALID))
goto out;
@ -1346,13 +1342,11 @@ parser_start_element (GMarkupParseContext *context,
goto out;
}
if (!g_markup_collect_attributes (element_name,
if (!g_markup_collect_known_attributes (element_name,
attribute_names,
attribute_values,
error,
G_MARKUP_COLLECT_STRING, "name", &name,
/* seen in the wild */
G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL, "version", NULL,
G_MARKUP_COLLECT_INVALID))
goto out;
@ -1378,7 +1372,7 @@ parser_start_element (GMarkupParseContext *context,
goto out;
}
if (!g_markup_collect_attributes (element_name,
if (!g_markup_collect_known_attributes (element_name,
attribute_names,
attribute_values,
error,
@ -1409,7 +1403,7 @@ parser_start_element (GMarkupParseContext *context,
goto out;
}
if (!g_markup_collect_attributes (element_name,
if (!g_markup_collect_known_attributes (element_name,
attribute_names,
attribute_values,
error,
@ -1460,7 +1454,7 @@ parser_start_element (GMarkupParseContext *context,
goto out;
}
if (!g_markup_collect_attributes (element_name,
if (!g_markup_collect_known_attributes (element_name,
attribute_names,
attribute_values,
error,
@ -1547,7 +1541,7 @@ parser_start_element (GMarkupParseContext *context,
goto out;
}
if (!g_markup_collect_attributes (element_name,
if (!g_markup_collect_known_attributes (element_name,
attribute_names,
attribute_values,
error,