trivial draft (not really working ) of xml writer function (stream based)