update writeDocument so that it doesn't close stream
added qualifiedName method taking prefix and localname
tutorial 1