Re: g_dbus_node_info_new_for_xml() and XML namespaces



Wouldn't a function g_markup_collect_attributes_ignore_unknown() be a viable solution as well?

On Mon, Sep 16, 2013 at 2:45 PM, Joseph Artsimovich <joseph artsimovich youview com> wrote:
Hello,

In DBus introspection XML files we write by hand, we use XML namespaces to put in various additional bits of information. Something very similar is done in the Telepathy project. It looks like this:
http://cgit.freedesktop.org/telepathy/telepathy-idle/tree/extensions/Connection_Interface_Renaming.xml

Now, it turns out Glib DBus introspection code fails in the presence of XML namespaces. The error I am getting from g_dbus_node_info_new_for_xml() is:
attribute 'xmlns:ns' invalid for element 'node'
The code in question is in gio/gdbusintrospection.c, but the error comes from g_markup_collect_attributes() in glib/gmarkup.c. It's not that GMarkup can't parse attributes with colon in the name, it's just that g_markup_collect_attributes() treats the presence of extra arguments besides those being requested as an error. That behaviour is not configurable.

So, I've got two options at this point. I can either write my own introspection XML parsing code or I can modify Glib code to ignore any unexpected attributes. I don't mean modifying the behaviour of g_markup_collect_attributes() but rather stopping using it in gdbusintrospection.c.
My question is, would such a change be acceptable for inclusion into Glib?

-- 
Joseph Artsimovich
Software Engineer at YouView TV Ltd


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]