Patches to remove some compilation warnings and to compile tests

Most of the changes are obvious, but do not hesitate to check the XML changes more carefully as the commits are not tested at all, they are only compiled with GCC 4.7.2 on Debian Wheezy.