For flat roofs:
You could manually create a height attribute in the shapefile if you're just doing this for one building. Otherwise, you need to import the OSM and then export the Topology and select Polygons. There is a guide for this kind of thing here:
Export the polygons to a Shapefile and then use GDAL_rasterize from the commandline (or possibly from QGIS) to burn in the elevation attribute into a blank raster. The last example on the GDAL_rasterize documentation sounds like what you want.
For non-flat roofs:
From looking at the XML of your data it seems like you have ridge height line and then a lower height which is presumably the height at the edges/walls /eaves of the building. I guess when visualised these make up planes of the roof. Thus there needs to be an interpolation between heights to arrive at a continous surface (gridded at the raster resolution).
I think your best approach will be to use GRASS. 1) Construct a 3D TIN representation based on your height values, using the ridgeline as a breakline in the triangulation. 2) Then convert this TIN surface to a raster (if you can in GRASS, I'm unsure), or sample the height TIN surface with a pre-defined grid of points that matches your desired raster resolution. I'm hazy on the precise technicalities of 2).