Minor refactoring of the common code.
Added getAttribute*() variants with char[], asked by Stéphane Landelle