summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Taylor <rob.taylor@codethink.co.uk>2008-03-17 15:10:43 +0100
committerColin Walters <walters@verbum.org>2010-04-28 13:12:47 -0400
commite5a76f43ed9901d095c9ac0c1df2ce2223392b9d (patch)
treed859c36dc055c43f919a983d67cafc7385e56db6
parent138e4ce76ae53b86488e12c43db511a838be4fc9 (diff)
downloaddbus-glib-e5a76f43ed9901d095c9ac0c1df2ce2223392b9d.tar.gz
allow namespaced extentions to introspection XML
This allows us to stick namespaced documentation stuff into the introspection XML and have dbus-glib not puke on it. Patch credit goes to Colin Walters.
-rw-r--r--dbus/dbus-glib-tool.c2
-rw-r--r--dbus/dbus-gparser.c40
2 files changed, 30 insertions, 12 deletions
diff --git a/dbus/dbus-glib-tool.c b/dbus/dbus-glib-tool.c
index e2c6a2c..55434de 100644
--- a/dbus/dbus-glib-tool.c
+++ b/dbus/dbus-glib-tool.c
@@ -414,7 +414,7 @@ main (int argc, char **argv)
&error);
if (node == NULL)
{
- lose_gerror (_("Unable to load \"%s\""), error);
+ lose (_("Unable to load \"%s\": %s"), filename, error->message);
}
else
{
diff --git a/dbus/dbus-gparser.c b/dbus/dbus-gparser.c
index f296f96..2520b5b 100644
--- a/dbus/dbus-gparser.c
+++ b/dbus/dbus-gparser.c
@@ -128,13 +128,17 @@ locate_attributes (const char *element_name,
if (!found)
{
- g_set_error (error,
- G_MARKUP_ERROR,
- G_MARKUP_ERROR_PARSE,
- _("Attribute \"%s\" is invalid on <%s> element in this context"),
- attribute_names[i], element_name);
- retval = FALSE;
- goto out;
+ /* We want to passthrough namespaced XML nodes that we don't know anything about. */
+ if (strchr (attribute_names[i], ':') == NULL)
+ {
+ g_set_error (error,
+ G_MARKUP_ERROR,
+ G_MARKUP_ERROR_PARSE,
+ _("Attribute \"%s\" is invalid on <%s> element in this context"),
+ attribute_names[i], element_name);
+ retval = FALSE;
+ goto out;
+ }
}
++i;
@@ -177,6 +181,7 @@ struct Parser
PropertyInfo *property;
ArgInfo *arg;
gboolean in_annotation;
+ guint unknown_namespaced_depth;
};
Parser*
@@ -791,10 +796,14 @@ parser_start_element (Parser *parser,
}
else
{
- g_set_error (error, G_MARKUP_ERROR,
- G_MARKUP_ERROR_PARSE,
- _("Element <%s> not recognized"),
- element_name);
+ if (strchr (element_name, ':') != NULL)
+ /* Passthrough XML-namespaced nodes */
+ parser->unknown_namespaced_depth += 1;
+ else if (parser->unknown_namespaced_depth == 0)
+ g_set_error (error, G_MARKUP_ERROR,
+ G_MARKUP_ERROR_PARSE,
+ _("Element <%s> not recognized"),
+ element_name);
}
return TRUE;
@@ -844,6 +853,15 @@ parser_end_element (Parser *parser,
if (parser->node_stack == NULL)
parser->result = top; /* We are done, store the result */
}
+ else if (strchr (element_name, ':') != NULL)
+ {
+ /* Passthrough XML-namespaced nodes */
+ parser->unknown_namespaced_depth -= 1;
+ }
+ else if (parser->unknown_namespaced_depth > 0)
+ {
+ /* pass through unknown elements underneath a namespace */
+ }
else
g_assert_not_reached (); /* should have had an error on start_element */