Whether xml is mandatory?

Dean Jenkins djenkins at mvista.com
Tue Aug 31 03:49:09 PDT 2010

On 30 August 2010 10:56, Raghavendra. S <raghavendra.akkasali at gmail.com> wrote:
> Hi,
>   I want to write a client code using dbus-glib for sync, async and signal
> receiving.
>   I saw many a places, xml codes to generate dbus glib bindings. Is this xml
> code mandatory to write a client code which I mentioned above?
If you are lucky, the D-bus server application will supply the XML
introspection files that can be used by your client. Also, you can use
the gnome application called D-feet to obtain the XML introspection
data of a given D-bus server application. However, XML introspection
data is not mandatory but is recommended. For example the D-bus server
application might not be constructed using dbus-glib but instead uses
libdbus directly where XML introspection data is optional.

You can hand craft the XML introspection data files for your client to
match that of the D-bus server application. For example, your client
may only need a sub-set of the available features of the D-bus server
application so you can chop out unnecessary stuff to minimise the
client's code.

The advantage of using XML introspection files is that is gives a
high-level view of the system interface without looking at the code.
However, the dbus-glib bindings tools do not extract all the
information from the XML introspection files so hand written code is
still needed to implement the API. Therefore, it is possible for the
source code to mismatch with the XML introspection files.

It is possible to use your own marshalling code to do the signature
translation so avoiding the use of the XML files. However, I would not
recommend that.

My impression is that gdbus will replace dbus-glib in the future. So
be aware of that.


More information about the dbus mailing list