Use an encoder to write XML elements to the stream

Make sure xmlns is being set on stream:stream elements