f = h5py.File('test.hdf5', 'w')
str_type = h5py.new_vlen(str)
ds = f.create_dataset('something.xml', shape=(1,), dtype=str_type)
ds[:] = xmldata
f.close()
f = h5py.File('test.hdf5', 'r')
print(f['something.xml'][0])
An XML file inside HDF5, h5py